Invocation Failed (Website made with Astro)

The site is Wakpedia

I can enter just fine to the / route of te website, but once I go to any of the 4 links in the menu the page won’t load. It just stays blank, if I try to reload then this error comes up

I go to the link of the function log but it doesn’t make any sense:

Mar 21, 02:21:12 PM: INIT_START Runtime Version: nodejs:20.v19	Runtime Version ARN: arn:aws:lambda:us-east-2::runtime:ecf83feba464e64dae4dc1a80327f8f786abd91aed7e0d884474a062cd1a7d63
Mar 21, 02:21:15 PM: 55de9999 Duration: 1661.09 ms	Memory Usage: 382 MB	Init Duration: 773.53 ms
Mar 21, 02:21:19 PM: 189549d5 ERROR  Invoke Error 	{"errorType":"ReferenceError","errorMessage":"stack is not defined","stack":["ReferenceError: stack is not defined","    at eval (eval at <anonymous> (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:2818:15), <anonymous>:1:10)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:2818:15","    at Array.reduce (<anonymous>)","    at parseEffect (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:2807:51)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157329:28","    at Array.map (<anonymous>)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157328:1168","    at AstroComponentInstance.Item [as factory] (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:81:12)","    at AstroComponentInstance.init (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1364:33)","    at AstroComponentInstance.render (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1369:22)"]}
Mar 21, 02:21:19 PM: 189549d5 ERROR  Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"ReferenceError: stack is not defined","reason":{"errorType":"ReferenceError","errorMessage":"stack is not defined","stack":["ReferenceError: stack is not defined","    at eval (eval at <anonymous> (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:2818:15), <anonymous>:1:10)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:2818:15","    at Array.reduce (<anonymous>)","    at parseEffect (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:2807:51)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157329:28","    at Array.map (<anonymous>)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157328:1168","    at AstroComponentInstance.Item [as factory] (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:81:12)","    at AstroComponentInstance.init (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1364:33)","    at AstroComponentInstance.render (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1369:22)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: ReferenceError: stack is not defined","    at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)","    at process.emit (node:events:518:28)","    at emit (node:internal/process/promises:150:20)","    at processPromiseRejections (node:internal/process/promises:284:27)","    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"]}
Mar 21, 02:21:19 PM: [ERROR] [1711027279184] LAMBDA_RUNTIME Failed to post handler success response. Http response code: 403.
Mar 21, 02:21:19 PM: RequestId: 189549d5-990f-430a-80de-25f30924be2e Error: Runtime exited with error: exit status 128
Runtime.ExitError
Mar 21, 02:21:19 PM: 189549d5 Duration: 638.89 ms	Memory Usage: 425 MB
Mar 21, 02:21:19 PM: INIT_START Runtime Version: nodejs:20.v19	Runtime Version ARN: arn:aws:lambda:us-east-2::runtime:ecf83feba464e64dae4dc1a80327f8f786abd91aed7e0d884474a062cd1a7d63
Mar 21, 02:21:21 PM: 0976161c ERROR  Invoke Error 	{"errorType":"TypeError","errorMessage":"Cannot read properties of undefined (reading 'includes')","stack":["TypeError: Cannot read properties of undefined (reading 'includes')","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157342:25","    at Array.map (<anonymous>)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157341:381","    at AstroComponentInstance.ListOfItems [as factory] (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:81:12)","    at AstroComponentInstance.init (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1364:33)","    at AstroComponentInstance.render (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1369:22)","    at Object.render (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1073:22)","    at renderChild (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:693:17)"]}
Mar 21, 02:21:21 PM: 0976161c ERROR  Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: Cannot read properties of undefined (reading 'includes')","reason":{"errorType":"TypeError","errorMessage":"Cannot read properties of undefined (reading 'includes')","stack":["TypeError: Cannot read properties of undefined (reading 'includes')","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157342:25","    at Array.map (<anonymous>)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157341:381","    at AstroComponentInstance.ListOfItems [as factory] (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:81:12)","    at AstroComponentInstance.init (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1364:33)","    at AstroComponentInstance.render (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1369:22)","    at Object.render (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1073:22)","    at renderChild (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:693:17)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: Cannot read properties of undefined (reading 'includes')","    at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)","    at process.emit (node:events:518:28)","    at emit (node:internal/process/promises:150:20)","    at processPromiseRejections (node:internal/process/promises:284:27)","    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"]}
Mar 21, 02:21:21 PM: Unknown application error occurred
Runtime.Unknown
Mar 21, 02:21:21 PM: 0976161c Duration: 1488.32 ms	Memory Usage: 323 MB
Mar 21, 02:21:21 PM: INIT_START Runtime Version: nodejs:20.v19	Runtime Version ARN: arn:aws:lambda:us-east-2::runtime:ecf83feba464e64dae4dc1a80327f8f786abd91aed7e0d884474a062cd1a7d63
Mar 21, 02:21:27 PM: ffbb7828 ERROR  Invoke Error 	{"errorType":"ReferenceError","errorMessage":"stack is not defined","stack":["ReferenceError: stack is not defined","    at eval (eval at <anonymous> (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:2818:15), <anonymous>:1:10)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:2818:15","    at Array.reduce (<anonymous>)","    at parseEffect (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:2807:51)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157329:28","    at Array.map (<anonymous>)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157328:1168","    at AstroComponentInstance.Item [as factory] (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:81:12)","    at AstroComponentInstance.init (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1364:33)","    at AstroComponentInstance.render (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1369:22)"]}
Mar 21, 02:21:27 PM: ffbb7828 ERROR  Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"ReferenceError: stack is not defined","reason":{"errorType":"ReferenceError","errorMessage":"stack is not defined","stack":["ReferenceError: stack is not defined","    at eval (eval at <anonymous> (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:2818:15), <anonymous>:1:10)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:2818:15","    at Array.reduce (<anonymous>)","    at parseEffect (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:2807:51)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157329:28","    at Array.map (<anonymous>)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157328:1168","    at AstroComponentInstance.Item [as factory] (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:81:12)","    at AstroComponentInstance.init (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1364:33)","    at AstroComponentInstance.render (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1369:22)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: ReferenceError: stack is not defined","    at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)","    at process.emit (node:events:518:28)","    at emit (node:internal/process/promises:150:20)","    at processPromiseRejections (node:internal/process/promises:284:27)","    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"]}
Mar 21, 02:21:27 PM: Unknown application error occurred
Runtime.Unknown
Mar 21, 02:21:27 PM: ffbb7828 Duration: 1840.95 ms	Memory Usage: 355 MB
Mar 21, 02:21:27 PM: INIT_START Runtime Version: nodejs:20.v19	Runtime Version ARN: arn:aws:lambda:us-east-2::runtime:ecf83feba464e64dae4dc1a80327f8f786abd91aed7e0d884474a062cd1a7d63
Mar 21, 02:21:29 PM: a71a1d30 ERROR  Invoke Error 	{"errorType":"TypeError","errorMessage":"Cannot read properties of undefined (reading 'includes')","stack":["TypeError: Cannot read properties of undefined (reading 'includes')","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157342:25","    at Array.map (<anonymous>)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157341:381","    at AstroComponentInstance.ListOfItems [as factory] (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:81:12)","    at AstroComponentInstance.init (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1364:33)","    at AstroComponentInstance.render (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1369:22)","    at Object.render (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1073:22)","    at renderChild (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:693:17)"]}
Mar 21, 02:21:29 PM: a71a1d30 ERROR  Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: Cannot read properties of undefined (reading 'includes')","reason":{"errorType":"TypeError","errorMessage":"Cannot read properties of undefined (reading 'includes')","stack":["TypeError: Cannot read properties of undefined (reading 'includes')","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157342:25","    at Array.map (<anonymous>)","    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1157341:381","    at AstroComponentInstance.ListOfItems [as factory] (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:81:12)","    at AstroComponentInstance.init (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1364:33)","    at AstroComponentInstance.render (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1369:22)","    at Object.render (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:1073:22)","    at renderChild (file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:693:17)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: Cannot read properties of undefined (reading 'includes')","    at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)","    at process.emit (node:events:518:28)","    at emit (node:internal/process/promises:150:20)","    at processPromiseRejections (node:internal/process/promises:284:27)","    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"]}
Mar 21, 02:21:29 PM: Unknown application error occurred
Runtime.Unknown
Mar 21, 02:21:29 PM: a71a1d30 Duration: 1460.49 ms	Memory Usage: 322 MB
Mar 21, 02:21:29 PM: INIT_START Runtime Version: nodejs:20.v19	Runtime Version ARN: arn:aws:lambda:us-east-2::runtime:ecf83feba464e64dae4dc1a80327f8f786abd91aed7e0d884474a062cd1a7d63

I’ve read it’s complaining about some let stack not being defined in parseEffect.js
But it does exist:
wakfupedia/src/utils/parseEffect.js at master · Visama396/wakfupedia (github.com) :Line 111

when I do pnpm astro dev and pnpm astro build in localhost it works fine I’m not getting any errors

Since you’re using pnpm, have you tried specifying PNPM_FLAGS environment variable to --shamefully-hoist?

How do I do it? I’ve never changed that


I changed it to the flag you told me. but still doesn’t work. It does the same

No, I mentioned an environment variable, so it should go here: Environment variables | Site configuration | wakpedia | Netlify. Name: PNPM_FLAGS value --shamefully-hoist.

I did it too, but it didn’t fix the problem. What does that flag do?

You’ll find an explanation in the pnpm install documentation.

This doesn’t seem to be a Netlify issue, this also happens locally:

At first, there’s a warning:

And then:

To test it locally, you’d have to use @astrojs/node | Docs and then npm run build && npm run preview.

npm run preview doesn’t work cause it says netlify adapter does not support the preview command

I made it work now.
Since astro build command was deleting the line let stack = 0 cause it believed it wasn’t used (it’s not used at build time) I decided to give it a use like console.log it so astro build wouldn’t delete it at code minification. And now it’s working. I still don’t know why I can’t do astro preview though, but at least my website is working. Thanks for everyone trying to help.

Hiya, thanks for reaching out and sharing your solution with the community.