Nuxt 3 App Working Locally but Throwing Errors on Netlify – Insights Needed!

Netlify Site Name: modernmedlife

I’m experiencing an issue with my Nuxt 3 (version 3.6.5) app hosted on Netlify (standard version, not Netlify Edge). Although the site is functioning perfectly on my local setup, I’m encountering console errors after deploying it to Netlify.

Here’s the process:

  1. The build stages complete successfully, and the site deploys without any issues.
  2. Upon viewing the live site (www.modernmedlife.com) in the browser console log, I receive the following errors:
entry.6a1cf06d.js:1
POST https://modernmedlife.com/api/__session 502
...
entry.6a1cf06d.js:1 Uncaught (in promise) FetchError: (502  (/api/__session))
    at async i (entry.6a1cf06d.js:1:93560)
    at async Mc (entry.6a1cf06d.js:3159:844)

Further Tracing Reveals:

errorMessage: "Cannot read properties of null (reading 'toString')"
errorType: "TypeError"
trace: ["TypeError: Cannot read properties of null (reading 'toString')", 
        "    at lambda (file:///var/task/.netlify/functions-internal/server/server.mjs:540655:19)"]

Impact of the Issue:
I discovered this problem when I found that I could no longer authenticate with Google on the deployed site. The authentication works fine when testing on my local host.

Additional Information from the Build Stage:
I also observed some warnings during the build stage of the deployment log. These warnings might be related to the issue I’m facing. Here are the details:

2:12:26 PM: Functions bundling                                            
2:12:26 PM: ────────────────────────────────────────────────────────────────
2:12:26 PM: ​
2:12:26 PM: Packaging Functions from .netlify/functions-internal directory:
2:12:26 PM:  - server/server.mjs
2:12:26 PM: ​
2:12:27 PM: ▲ [WARNING] Ignoring this import because .netlify/functions-internal/server/node_modules/ufo/dist/index.mjs was marked as having no side effects
2:12:27 PM:     .netlify/functions-internal/server/server.mjs:2:7:
2:12:27 PM:       2 │ import 'ufo';
2:12:27 PM:         ╵        ~~~~~
2:12:27 PM:   sideEffects is false in the enclosing package.json file
2:12:27 PM:     .netlify/functions-internal/server/node_modules/ufo/package.json:7:2:
2:12:27 PM:       7 │   sideEffects: false,
2:12:27 PM:         ╵   ~~~~~~~~~~~~~
2:12:27 PM: ▲ [WARNING] Ignoring this import because .netlify/functions-internal/server/node_modules/h3/dist/index.mjs was marked as having no side effects
2:12:27 PM:     .netlify/functions-internal/server/server.mjs:4:7:
2:12:27 PM:       4 │ import 'h3';
2:12:27 PM:         ╵        ~~~~
2:12:27 PM:   sideEffects is false in the enclosing package.json file
2:12:27 PM:     .netlify/functions-internal/server/node_modules/h3/package.json:7:2:
2:12:27 PM:       7 │   sideEffects: false,
2:12:27 PM:         ╵   ~~~~~~~~~~~~~
2:12:27 PM: ▲ [WARNING] Ignoring this import because .netlify/functions-internal/server/node_modules/radix3/dist/index.mjs was marked as having no side effects
2:12:27 PM:     .netlify/functions-internal/server/server.mjs:6:7:
2:12:27 PM:       6 │ import 'radix3';
2:12:27 PM:         ╵        ~~~~~~~~
2:12:27 PM:   sideEffects is false in the enclosing package.json file
2:12:27 PM:     .netlify/functions-internal/server/node_modules/radix3/package.json:7:2:
2:12:27 PM:       7 │   sideEffects: false,
2:12:27 PM:         ╵   ~~~~~~~~~~~~~
2:12:27 PM: ▲ [WARNING] Ignoring this import because .netlify/functions-internal/server/node_modules/scule/dist/index.mjs was marked as having no side effects
2:12:27 PM:     .netlify/functions-internal/server/server.mjs:8:7:
2:12:27 PM:       8 │ import 'scule';
2:12:27 PM:         ╵        ~~~~~~~
2:12:27 PM:   sideEffects is false in the enclosing package.json file
2:12:27 PM:     .netlify/functions-internal/server/node_modules/scule/package.json:7:2:
2:12:27 PM:       7 │   sideEffects: false,
2:12:27 PM:         ╵   ~~~~~~~~~~~~~
2:12:27 PM: ▲ [WARNING] Ignoring this import because .netlify/functions-internal/server/node_modules/ofetch/dist/node.mjs was marked as having no side effects
2:12:27 PM:     .netlify/functions-internal/server/server.mjs:10:7:
2:12:27 PM:       10 │ import 'ofetch';
2:12:27 PM:          ╵        ~~~~~~~~
2:12:27 PM:   sideEffects is false in the enclosing package.json file
2:12:27 PM:     .netlify/functions-internal/server/node_modules/ofetch/package.json:7:2:
2:12:27 PM:       7 │   sideEffects: false,
2:12:27 PM:         ╵   ~~~~~~~~~~~~~
2:12:27 PM: ▲ [WARNING] Ignoring this import because .netlify/functions-internal/server/node_modules/unenv/runtime/fetch/index.mjs was marked as having no side effects
2:12:27 PM:     .netlify/functions-internal/server/server.mjs:11:7:
2:12:27 PM:       11 │ import 'unenv/runtime/fetch/index';
2:12:27 PM:          ╵        ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2:12:27 PM:   sideEffects is false in the enclosing package.json file
2:12:27 PM:     .netlify/functions-internal/server/node_modules/unenv/package.json:7:2:
2:12:27 PM:       7 │   sideEffects: false,
2:12:27 PM:         ╵   ~~~~~~~~~~~~~
2:12:27 PM: ▲ [WARNING] Ignoring this import because .netlify/functions-internal/server/node_modules/ohash/dist/index.mjs was marked as having no side effects
2:12:27 PM:     .netlify/functions-internal/server/server.mjs:13:7:
2:12:27 PM:       13 │ import 'ohash';
2:12:27 PM:          ╵        ~~~~~~~
2:12:27 PM:   sideEffects is false in the enclosing package.json file
2:12:27 PM:     .netlify/functions-internal/server/node_modules/ohash/package.json:7:2:
2:12:27 PM:       7 │   sideEffects: false,
2:12:27 PM:         ╵   ~~~~~~~~~~~~~
2:12:27 PM: ▲ [WARNING] Ignoring this import because .netlify/functions-internal/server/node_modules/unstorage/dist/index.mjs was marked as having no side effects
2:12:27 PM:     .netlify/functions-internal/server/server.mjs:14:7:
2:12:27 PM:       14 │ import 'unstorage';
2:12:27 PM:          ╵        ~~~~~~~~~~~
2:12:27 PM:   sideEffects is false in the enclosing package.json file
2:12:27 PM:     .netlify/functions-internal/server/node_modules/unstorage/package.json:7:2:
2:12:27 PM:       7 │   sideEffects: false,
2:12:27 PM:         ╵   ~~~~~~~~~~~~~
2:12:27 PM: ▲ [WARNING] Ignoring this import because .netlify/functions-internal/server/node_modules/unstorage/drivers/overlay.mjs was marked as having no side effects
2:12:27 PM:     .netlify/functions-internal/server/server.mjs:15:7:
2:12:27 PM:       15 │ import 'unstorage/drivers/overlay';
2:12:27 PM:          ╵        ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2:12:27 PM:   sideEffects is false in the enclosing package.json file
2:12:27 PM:     .netlify/functions-internal/server/node_modules/unstorage/package.json:7:2:
2:12:27 PM:       7 │   sideEffects: false,
2:12:27 PM:         ╵   ~~~~~~~~~~~~~
2:12:27 PM: ▲ [WARNING] Ignoring this import because .netlify/functions-internal/server/node_modules/unstorage/drivers/memory.mjs was marked as having no side effects
2:12:27 PM:     .netlify/functions-internal/server/server.mjs:16:7:
2:12:27 PM:       16 │ import 'unstorage/drivers/memory';
2:12:27 PM:          ╵        ~~~~~~~~~~~~~~~~~~~~~~~~~~
2:12:27 PM:   sideEffects is false in the enclosing package.json file
2:12:27 PM:     .netlify/functions-internal/server/node_modules/unstorage/package.json:7:2:
2:12:27 PM:       7 │   sideEffects: false,
2:12:27 PM:         ╵   ~~~~~~~~~~~~~
2:12:27 PM: 10 of 2397 warnings shown (disable the message limit with --log-limit=0)
2:12:28 PM: ​
2:12:28 PM: ❯ Functions bundled with warnings:
2:12:28 PM:    - server.zip
2:12:28 PM: ​
2:12:28 PM: (Functions bundling completed in 2.3s)
2:12:28 PM: ​
2:12:36 PM: (Netlify Build completed in 1m 12.3s)
2:12:37 PM: Section completed: building

These warnings appear to be related to specific imports being ignored due to sideEffects: false in the corresponding package.json files.

I’m wondering if these warnings could be a part of the problem I’m facing with the live deployment. If anyone has encountered a similar problem or has insights into what might be going wrong, your assistance would be greatly appreciated. Thank you!

An Update: I still don’t know what the issue is, but I deployed successfully to Vercel. Seems something is going on with the Netlify functions folder.

This would be an issue for Nuxt team to investigate as they generate the required functions for Netlify. On a side note, I tried using a blank Nuxt site and did not encounter this issue, so it’s also possible this is something specific to your setup.