hundreds-student-32136
09/16/2024, 8:03 PMwindow is not defined
, seems to be occurring when the lambda is starting up.
end of stack trace points to
this line - https://github.com/pulumi/pulumi/blob/f74a5dfec10c83584e65b3535cbbc138741ba2c5/sdk/nodejs/proto/status_pb.js#L16hundreds-student-32136
09/16/2024, 8:04 PM{
"errorType": "ReferenceError",
"errorMessage": "window is not defined",
"stack": [
"ReferenceError: window is not defined",
" at file:///var/task/packages/pulumi-test/src/event-handlers/function-pulumi-test.mjs:292090:22",
" at node_modules/.pnpm/@pulumi+pulumi@3.132.0_typescript@5.6.2/node_modules/@pulumi/pulumi/proto/status_pb.js (file:///var/task/packages/pulumi-test/src/event-handlers/function-pulumi-test.mjs:292091:7)",
" at __require2 (file:///var/task/packages/pulumi-test/src/event-handlers/function-pulumi-test.mjs:24:51)",
" at node_modules/.pnpm/@pulumi+pulumi@3.132.0_typescript@5.6.2/node_modules/@pulumi/pulumi/provider/server.js (file:///var/task/packages/pulumi-test/src/event-handlers/function-pulumi-test.mjs:292291:36)",
" at __require2 (file:///var/task/packages/pulumi-test/src/event-handlers/function-pulumi-test.mjs:24:51)",
" at node_modules/.pnpm/@pulumi+pulumi@3.132.0_typescript@5.6.2/node_modules/@pulumi/pulumi/provider/index.js (file:///var/task/packages/pulumi-test/src/event-handlers/function-pulumi-test.mjs:292814:15)",
" at __require2 (file:///var/task/packages/pulumi-test/src/event-handlers/function-pulumi-test.mjs:24:51)",
" at node_modules/.pnpm/@pulumi+pulumi@3.132.0_typescript@5.6.2/node_modules/@pulumi/pulumi/index.js (file:///var/task/packages/pulumi-test/src/event-handlers/function-pulumi-test.mjs:367822:33)",
" at __require2 (file:///var/task/packages/pulumi-test/src/event-handlers/function-pulumi-test.mjs:24:51)",
" at node_modules/.pnpm/@pulumi+aws@6.51.1_typescript@5.6.2/node_modules/@pulumi/aws/index.js (file:///var/task/packages/pulumi-test/src/event-handlers/function-pulumi-test.mjs:506518:19)"
]
}
victorious-church-57397
09/16/2024, 8:10 PMwindow
is a browser element, it looks like there's some issue executing in AWS lambda and pulumi thinks its running in a browser, when really it should be returning global
victorious-church-57397
09/16/2024, 8:11 PMvictorious-church-57397
09/16/2024, 8:12 PMhundreds-student-32136
09/16/2024, 8:19 PMvictorious-church-57397
09/16/2024, 8:21 PMhundreds-student-32136
09/16/2024, 8:42 PMvictorious-church-57397
09/16/2024, 8:43 PMvictorious-church-57397
09/16/2024, 8:44 PMwindow
is symptomatic of bundling. are you able to try without bundling as you suggested?victorious-church-57397
09/16/2024, 8:44 PMhundreds-student-32136
09/16/2024, 8:50 PMclean-machine-8609
09/17/2024, 8:58 AMclean-machine-8609
09/17/2024, 8:59 AMReferenceError: window is not defined
hundreds-student-32136
09/17/2024, 1:20 PMReferenceError: window is not defined
with the suggestion of installing the pulumi library instead of bundling it when deploying to the AWS lambda
I'm getting a new error but it looks like its a function serialization error so trying to sort that out now.
@victorious-church-57397 - Thanks again for taking a lookvictorious-church-57397
09/17/2024, 1:21 PMclean-machine-8609
09/18/2024, 8:32 AMclean-machine-8609
11/04/2024, 8:45 PMesbuild --external:@pulumi/pulumi --external:@pulumi/aws
• Install pulumi in Docker
FROM base AS pulumi-install
RUN curl -fsSL <https://get.pulumi.com/> | bash -s -- --version 3.137.0
• Install the pulumi nodejs dependencies
RUN pnpm install -w @pulumi/pulumi
RUN pnpm install -w @pulumi/aws
Additional points:
• set PULUMI_HOME, can be in Docker like ENV PULUMI_HOME="/tmp"
• increase Ephemeral storage in Lambda: 512 MB is not enough. 3072 MB is better to install pulumi and plugins
• increase lambda memory to 2048 MB
That's all folks 😉