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

ref(nuxt): Add instument.server.mjs to preview script #38

Merged
merged 3 commits into from
Jul 26, 2024

Conversation

s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Jul 10, 2024

This setup for ESM-compatibility throws an error and the pages cannot load. I think this is also related to this issue: nodejs/import-in-the-middle#139

Another comment where people have problems with vue/server-renderer: getsentry/sentry-javascript#12114 (comment)

Steps to reproduce the import-in-the-middle issue:

  • define the SENTRY_DSN environment variable
  • Build the nuxt project
  • Preview the nuxt project
  • Load a page

Error Message:

Error: 'import-in-the-middle' failed to wrap 'file:///Users/sigridh/Documents/DEV/sentry-javascript-examples/apps/nuxt/.output/server/node_modules/vue/server-renderer/index.mjs'
    at getSource (/Users/sigridh/Documents/DEV/sentry-javascript-examples/node_modules/@sentry/nuxt/node_modules/import-in-the-middle/hook.js:304:21)
    at async load (/Users/sigridh/Documents/DEV/sentry-javascript-examples/node_modules/@sentry/nuxt/node_modules/import-in-the-middle/hook.js:319:26)
    at async nextLoad (node:internal/modules/esm/hooks:865:22)
    at async Hooks.load (node:internal/modules/esm/hooks:448:20)
    at async MessagePort.handleMessage (node:internal/modules/esm/worker:196:18) {
  cause: TypeError: emitImportAssertionWarning is not a function
      at defaultLoad (node:internal/modules/esm/load:119:5)
      at nextLoad (node:internal/modules/esm/hooks:865:28)
      at getExports (/Users/sigridh/Documents/DEV/sentry-javascript-examples/node_modules/@sentry/nuxt/node_modules/import-in-the-middle/lib/get-exports.js:80:27)
      at processModule (/Users/sigridh/Documents/DEV/sentry-javascript-examples/node_modules/@sentry/nuxt/node_modules/import-in-the-middle/hook.js:131:29)
      at getSource (/Users/sigridh/Documents/DEV/sentry-javascript-examples/node_modules/@sentry/nuxt/node_modules/import-in-the-middle/hook.js:269:31)
      at load (/Users/sigridh/Documents/DEV/sentry-javascript-examples/node_modules/@sentry/nuxt/node_modules/import-in-the-middle/hook.js:319:32)
      at nextLoad (node:internal/modules/esm/hooks:865:28)
      at Hooks.load (node:internal/modules/esm/hooks:448:26)
      at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
      at [nodejs.internal.kHybridDispatch] (node:internal/event_target:826:20)
}

@s1gr1d s1gr1d force-pushed the sig/instrument-sentry-nuxt branch from 21e0d6a to 6c500aa Compare July 10, 2024 12:00
@s1gr1d s1gr1d force-pushed the sig/instrument-sentry-nuxt branch from 6c500aa to 644c8d4 Compare July 10, 2024 12:01
@AbhiPrasad
Copy link
Member

Could you force yarn to resolve import-in-the-middle@1.9.0? Curious to see if that changes the error.

@s1gr1d
Copy link
Member Author

s1gr1d commented Jul 10, 2024

I added it to resolutions and also dependencies, but the error persists

@s1gr1d
Copy link
Member Author

s1gr1d commented Jul 23, 2024

This was fixed with version 1.10.0 of import-in-the-middle 🎉
ref: nodejs/import-in-the-middle#140 and nodejs/import-in-the-middle#145

@s1gr1d s1gr1d merged commit 021592b into main Jul 26, 2024
2 checks passed
@s1gr1d s1gr1d deleted the sig/instrument-sentry-nuxt branch July 26, 2024 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants