is this a pulumi bug? I'm importing a non-pulumi TS package with pulumi components `error: Runn...
h
is this a pulumi bug? I'm importing a non-pulumi TS package with pulumi components
error: Running program '${PROJECT_ROOT}/src/index.ts' failed with an unhandled exception:
RangeError: Invalid string length
at markNodeModules (node:internal/util/inspect:1456:21)
at formatError (node:internal/util/inspect:1546:18)
at formatRaw (node:internal/util/inspect:1067:14)
at formatValue (node:internal/util/inspect:922:10)
at Object.inspect (node:internal/util/inspect:409:10)
at Object.defaultErrorMessage (${PROJECT_ROOT}/node_modules/.pnpm/@pulumi+pulumi@3.197.0_typescript@5.9.2/node_modules/@pulumi/cmd/run/error.ts:28:21)
at process.uncaughtHandler (${PROJECT_ROOT}/node_modules/.pnpm/@pulumi+pulumi@3.197.0_typescript@5.9.2/node_modules/@pulumi/cmd/run/run.ts:445:3)
at process.emit (node:events:520:35)
at process.emit (${PROJECT_ROOT}/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:516:21)
at process.emit (${PROJECT_ROOT}/node_modules/.pnpm/@pulumi+pulumi@3.197.0_typescript@5.9.2/node_modules/@pulumi/pulumi/vendor/ts-node@7.0.1/index.js:2204:25)
error: an unhandled error occurred: Program exited with non-zero exit code: 1
e
Your probably making a massive string in your program
h
yeah, that's what everyone on the internet says. The largest strings in this program are kubeconf for one cluster and 1kb toml file
I couldn't find a way to show what line exactly is causing it, the stacktrace doesn't show my code at all
the kubeconf is an output from another stack imported via stakref
e
ah yeh looks like the trying to stringify the error object itself is what's failing
probably worth raising an issue about this
we can see about catching that and reporting a shorter error when
util.inspect
fails
h
No probs, I'll do that. For the immediate solution, I see that removing the stackref to get the kubeconf resolves it, even tho it has worked before
I tried removing the stackrefs and the file read but it didn't help. the only way to make
pulumi up
work is to remove everything 😄
e
might be worth seeing if you can attach a debugger to the program to see if you can inspect what the error is before it triggers the string too large error
h
If I understand correctly from the stacktrace, pulumi runs some other process; which one are you referring to?
e
https://www.pulumi.com/docs/iac/concepts/debugging/ I just mean your typescript program, the
@pulumi/cmd/run
stuff is just part of the pulumi sdk, its not a separate process.
h
@pulumi/pulumi@3.160
shows the source error
ReferenceError: exports is not defined in ES module scope Like I said, it's not trivial to do microstacks 🙂
e
yeh that's nodejs oddness, not my expertise but I think something to do with module types like commonjs vs esnext and the like
h
and the winner is "type": "module" in the dependency. Thank you @echoing-dinner-19531, downgrading pulumi (sdk, not cli) did the job and should've been obvious, but it just didn't occur to me. Keeping the gh issue open, since it's on error handling
e
🙌 yay glad you worked it out. We'll try to get to that error handling issue soon to help out any future issues with errors here.
🙏 1