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

Problems with @sentry/astro on Netlify using SSR #5738

Open
whitep4nth3r opened this issue Jun 25, 2024 · 2 comments
Open

Problems with @sentry/astro on Netlify using SSR #5738

whitep4nth3r opened this issue Jun 25, 2024 · 2 comments
Labels
type: bug code to address defects in shipped code

Comments

@whitep4nth3r
Copy link

whitep4nth3r commented Jun 25, 2024

Describe the bug

I am opening this issue to cross-reference this issue from the Sentry organisation: getsentry/sentry-javascript#12603

Steps to reproduce

  1. Create an Astro project that uses SSR
  2. Install Sentry using npx astro add @sentry/astro (see more docs here)
  3. Deploy to Netlify
  4. Navigate to any page that uses SSR
  5. Observe the error logs in Netlify such as:
WARN   Sentry Logger [warn]: Failed to register ESM hook Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/var/task/node_modules/@opentelemetry/instrumentation/hook.mjs' imported from /var/task/node_modules/@sentry/node/esm/sdk/initOtel.js
    at finalizeResolution (node:internal/modules/esm/resolve:269:11)
    at moduleResolve (node:internal/modules/esm/resolve:937:10)
    at moduleResolveWithNodePath (node:internal/modules/esm/resolve:1161:14)
    at defaultResolve (node:internal/modules/esm/resolve:1204:79)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:304:30)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:345:35)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:227:38)
    at ModuleLoader.import (node:internal/modules/esm/loader:315:34)
    at Hooks.register (node:internal/modules/esm/hooks:165:53) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///var/task/node_modules/@opentelemetry/instrumentation/hook.mjs'
}

Configuration

My current netlify.toml looks like this, the included_files is attempting to fix the issue. Please see the referenced issue in the description above for more details.

[build]
  command = "npm run build"
  functions = "netlify/functions"
  publish = "dist"

[functions]
  included_files = ["node_modules/@opentelemetry/instrumentation/hook.mjs", "node_modules/import-in-the-middle/hook.mjs"]

Deploy logs

No deploys are failing.

@whitep4nth3r whitep4nth3r added the type: bug code to address defects in shipped code label Jun 25, 2024
@AbhiPrasad
Copy link

From the Sentry side our current working theory is that this is caused by https://www.npmjs.com/package/@netlify/zip-it-via @vercel/nft. We filed a GH issue with @vercel/nft as well vercel/nft#428

@timfish
Copy link

timfish commented Jul 10, 2024

This should be fixed by this PR:
vercel/nft#429

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

3 participants