question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[@sentry/remix] - ESM error when importing @sentry/remix

See original GitHub issue

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/remix

SDK Version

7.4.1

Framework Version

1.5.1

Link to Sentry event

No response

Steps to Reproduce

Running the app will surface the error. You can see the instructions here: https://github.com/webstudio-is/webstudio/blob/main/docs/contributing.md#designer-installation

Expected Result

No error happens

Actual Result

As soon as the server starts I see this error on both the browser and terminal

/Users/saravieira/Projects/webstudio-designer/node_modules/@sentry/remix/esm/index.server.js:1
import { getCurrentHub, init as init$1, configureScope } from '@sentry/node';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:1001:16)
    at Module._compile (internal/modules/cjs/loader.js:1049:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object.<anonymous> (/Users/saravieira/Projects/webstudio-designer/app/entry.server.tsx:5:25)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at /Users/saravieira/Projects/webstudio-designer/node_modules/@remix-run/serve/dist/index.js:43:17
    at Layer.handle [as handle_request] (/Users/saravieira/Projects/webstudio-designer/node_modules/express/lib/router/layer.js:95:5)

I am currently using v16.15.1 of node

Here is the code I used in a PR: https://github.com/webstudio-is/webstudio-designer/pull/103/files

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
SaraVieiracommented, Jul 5, 2022

Working great!  🚀

2reactions
vladanpaunoviccommented, Jul 4, 2022

Hey @SaraVieira thanks for trying @sentry/remix and this beautiful write-up of the issue! And thanks to our hero @nfelger for fixing this!

In a few hours, we will test & review the PR so you will get a working release soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gotchas - Remix
Importing ESM Packages. You may try importing an ESM-only package into your app and see an error like this when server rendering: Error...
Read more >
Troubleshooting for Remix | Sentry Documentation
Troubleshoot and resolve edge cases.
Read more >
Importing pure ESM module in TS project fails Jest test with ...
I have set the ESM options as indicated here but still get a SyntaxError: Cannot use import statement outside a module error.
Read more >
ESM error when trying to import Map from "@arcgis
Hi, I am trying to write tests using the create react app example and am getting the following error: To reproduce the error:...
Read more >
ERR_REQUIRE_ESM - DEV Community ‍ ‍
To save anybody's googling time Once you update you package deps you may face with the error... Tagged with esm, es6, require, import....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found