Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt in Netlify #13697

Open
3 tasks done
noemission opened this issue Sep 13, 2024 · 5 comments
Open
3 tasks done

Nuxt in Netlify #13697

noemission opened this issue Sep 13, 2024 · 5 comments
Labels
Package: nuxt Issues related to the Sentry Nuxt SDK Waiting for: Community

Comments

@noemission
Copy link

noemission commented Sep 13, 2024

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nuxt

SDK Version

8.28.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

I am trying to use Nuxt with Sentry in Netlify. I followed all the steps in the doc and managed to integrate Sentry when Nuxt is built with the node preset.
The issue comes when Nuxt is built with the Netlify preset which creates a lambda function bundled in a single JS file.

No matter what I try, the Netlify function will only contain a single server.js file and the instrument.server.mjs will not be there

PS. Adding the --import flag to the NODE_OPTIONS env variable works and Netlify tries to load the file, but the file is not uploaded.

Expected Result

The instrument.server.mjs is uploaded in Netlify and somehow loaded using --import or NODE_OPTIONS

Actual Result

The lambda function directory contains only the bundled Nuxt code and instrument.server.mjs is missing

Related discussion

@github-actions github-actions bot added the Package: nuxt Issues related to the Sentry Nuxt SDK label Sep 13, 2024
@rokgerzelj
Copy link

I am facing the same issue. Following the SDK docs to set up sentry and then running pnpm run build --preset netlify in a nuxt project outputs two directories:

  1. .netlify/functions-internal/server which is the server lambda. instrument.server.mjs does not get included here, and therefore can't be imported with the NODE_OPTIONS env var.
  2. dist which includes the server folder. instrument.server.mjs gets copied here from the public folder, but that is not helpful.

@s1gr1d
Copy link
Member

s1gr1d commented Sep 16, 2024

Hello, this is a known issue we still need to figure out. I will keep you updated on this topic! :)

@DeVoresyah
Copy link

I also facing same issue, is there any updates?

@DeVoresyah
Copy link

for me, here's the error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/var/task/<output-dir>/.netlify/functions-internal/server/node_modules/import-in-the-middle/hook.mjs' imported from /var/task/<output-dir>/.netlify/functions-internal/server/server.mjs
Did you mean to import import-in-the-middle/hook.mjs?

@s1gr1d
Copy link
Member

s1gr1d commented Oct 29, 2024

This is still something we need to figure out as this is something that cannot be fixed only from our side.

But how does your server-side init look like and which version do you use? Did you add the override/resolution like described in the docs? https://docs.sentry.io/platforms/javascript/guides/nuxt/#troubleshoot-errors-during-server-startup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nuxt Issues related to the Sentry Nuxt SDK Waiting for: Community
Projects
Status: Waiting for: Community
Development

No branches or pull requests

5 participants