brave-scientist-99340
05/16/2022, 7:59 PMError serializing '() => provider...
basically meaning that the dynamic provider could not be serialized (I expected this).
But I cannot for the life of me figure out how to exclude the @prisma/client
package from being serialized. I tried:
• Custom typescript compilation
• Using await("@prisma/client")
• deploymentOnlyModule
(found this in the code, but does not seem to work)
• runtimeDependencies
(pretty sure this only applies to the serialized lambda functions)
• I tried to search for the code that excludes aws-sdk
to piggyback on that, but I could not actually find it...
Any help is appreciated!miniature-musician-31262
05/17/2022, 12:03 AMbrave-scientist-99340
05/17/2022, 3:46 PMminiature-musician-31262
05/18/2022, 12:28 AM'() => provider': index.js(28,47): captured
variable 'provider' which indirectly referenced
function 'create': edge-node-provider.ts(36,10): which captured
variable 'prisma' which indirectly referenced
'(userArgs) => { const callsite = get ...': index.js(42810,9): which captured
variable 'client' which indirectly referenced
function 'setMaxListeners': which captured
'NumberIsNaN', a function defined at
function 'isNaN': which could not be serialized because
it was a native code function.
Function code:
function isNaN() { [native code] }
prisma.node.create
ultimately calls into the native JS function isNaN
, which can’t be serialized: https://www.pulumi.com/docs/intro/concepts/function-serialization/#known-limitations-when-capturing-values
this limitation is also mentioned in the dynamic providers documentation: https://www.pulumi.com/docs/intro/concepts/resources/dynamic-providers/#how-dynamic-providers-workbrave-scientist-99340
05/18/2022, 12:00 PMasync create(inputs: EdgeNodeInputs) {
const proc = execFileSync("dist/lifecycle.js", [
"create",
JSON.stringify([inputs]),
]);
return JSON.parse(proc.toString());
},
async delete(id, props: Node) {
const proc = execFileSync("dist/lifecycle.js", [
"delete",
JSON.stringify([id, props]),
]);
return JSON.parse(proc.toString());
},
Basically, I moved all of the critical code into a different file that is also compiled and just execute it 🙂 .
Its a bit hacky but it works great. Also it allows me greater control than the local.Command
miniature-musician-31262
05/19/2022, 1:49 PM