This repository was archived by the owner on Sep 17, 2024. It is now read-only.
This repository was archived by the owner on Sep 17, 2024. It is now read-only.
__dirname is not defined in ES module scope
error when setting up profiling for Remix #217
Open
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/profiling-node/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/profiling-node/releases
How do you use Sentry?
Sentry Saas (sentry.io)
SDK Version
7.81.1
Link to Sentry event
N/A
What environment is your node script running in?
Remix 2.1.0
How is your code deployed and bundled?
Remix running in AWS Lambda
Steps to Reproduce
Followed the steps to set up my Remix application with profiling as described by the sidebar that appears when clicking Set up Profiling

Below is my code for setting up @sentry/remix
in my entry.server.ts
file.
import * as SentryRemix from "@sentry/remix"
SentryRemix.init({
dsn: "omitted",
tracesSampleRate: 1,
profilesSampleRate: 1,
integrations: [
new SentryRemix.Integrations.LocalVariables({
captureAllExceptions: true,
}),
new ProfilingIntegration()
],
})
Expected Result
Profiling works correctly
Actual Result
When I deploy this, I see the following 500 error
2023-12-06T19:44:49.312Z undefined ERROR Uncaught Exception
{
"errorType": "ReferenceError",
"errorMessage": "__dirname is not defined in ES module scope",
"stack": [
"ReferenceError: __dirname is not defined in ES module scope",
" at node_modules/@sentry/profiling-node/lib/index.js (file:///var/task/ui/build/index.mjs:48006:777)",
" at file:///var/task/ui/build/index.mjs:26:50",
" at file:///var/task/ui/build/index.mjs:108280:37"
]
}
Metadata
Metadata
Assignees
Labels
No labels