My deployment (`pulumi up` using `@pulumi/aws`) is...
# general
f
My deployment (
pulumi up
using
@pulumi/aws
) is failing with:
pulumipulumiStack stackname running error: Running program '/home/chris/Projects/project' failed with an unhandled exception: undefined
Any clue what is undefined here? Or how I could find some ideas where to look next?
w
That error means that you have an unhandled exception from you JS/TS code. The particular case of
undefined
here looks like i means you somehow had code throw an error that didn't have either a
stack
or
message
property - most common if something other than an
Error
was thrown. Could this have been from your own code somewhere? (do you have any
throw
statements of your own?)
f
thanks, that's usefull! Will search for such pattern
Although I found some occurrences of `throw [someVal, "string"];`and replaced all of them with
throw new Error("someMessage");
, I still get the same error-message on deployment. I tried running deployment with
pulumi up -d -v 99 --logtostderr
but couldn't find any more information why or where this undefined exception is coming from. If I understood correctly Pulumi tries to access
Error.stack
and
Error.message
on an unhandled exception. Is it somehow possible to log the actual unhandled exception and not just properties of it? I'd like to add something like:
Copy code
if(!(err instanceof Error)) {
	    console.log("Unhandled Exception which is not an Error:", err);
    }
to the
uncaughtHandler
in the pulumi nodejs sdk. How is the build process, to respect changes I make in the node_modules directory of ´@pulumi/pulumi` when I run
pulumi up
.
w
How is the build process, to respect changes I make in the node_modules directory of ´@pulumi/pulumi` when I run
pulumi up
.
You can make changes in
node_modues
and they will get picked up.
Is it somehow possible to log the actual unhandled exception and not just properties of it?
Yes - we should probably try `toString`ing the thrown value itself after trying it's
stack
and
message
properties.
I'd like to add ... to the
uncaughtHandler
You could also try adding your own
process.on('uncaughtException', () => {})
.
f
I tried the
process.on
approach at the top of the pulumi application first, but for some reason this didn't work. I added
console.log("unhandled exception:", err);
in
@pulumi/pulumi/cmd/run/run.js:176
and
@pulumi/pulumi/cmd/run-policy-pack/run.js:180
, which got me the information I needed! 🙂 I forgot braces at my first attempt of conditionally logging the error, which made me think my changes weren't picked up by pulumi. Thanks a lot Luke!