So I am trying to get Sentry + Remix to work. Right now I am struggling to get environment variables to load. Here is my repo.
I have these variables set in my deployment:
But then when I build, the Sentry CLI doesn’t pick up the environment variable:
=> ERROR [build 6/6] RUN npm run build 6.6s
------
> [build 6/6] RUN npm run build:
#18 0.574
#18 0.574 > build
#18 0.574 > run-s build:*
#18 0.574
#18 1.041
#18 1.041 > build:remix
#18 1.041 > remix build --sourcemap
#18 1.041
#18 1.980 Building Remix app in production mode...
#18 1.980
#18 1.980 ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
#18 1.980 You have enabled source maps in production. This will make your server-side code visible to the public and is highly discouraged! If you insist, please ensure you are using environment variables for secrets and not hard-coding them into your source!
#18 1.980 ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
#18 1.980
#18 4.926 Built in 2.9s
#18 5.668
#18 5.668 > build:server
#18 5.668 > tsx ./other/build-server.ts
#18 5.668
#18 6.083
#18 6.083 building...
#18 6.136
#18 6.136 server-build/index.js 4.3kb
#18 6.136
#18 6.136 ⚡ Done in 4ms
#18 6.514
#18 6.514 > build:sentry
#18 6.514 > sentry-upload-sourcemaps
#18 6.514
#18 6.595 node:internal/errors:867
#18 6.595 const err = new Error(message);
#18 6.595 ^
#18 6.595
#18 6.595 Error: Command failed: /myapp/node_modules/@sentry/cli/sentry-cli releases new 072723aaad54a05109d88b2dba9ed10460fc3a35
#18 6.595 error: An organization slug is required (provide with --org)
#18 6.595
#18 6.595 Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
#18 6.595 Please attach the full debug log to all bug reports.
#18 6.595
#18 6.595 at ChildProcess.exithandler (node:child_process:419:12)
#18 6.595 at ChildProcess.emit (node:events:513:28)
#18 6.595 at maybeClose (node:internal/child_process:1091:16)
#18 6.595 at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
#18 6.595 code: 1,
#18 6.595 killed: false,
#18 6.595 signal: null,
#18 6.595 cmd: '/myapp/node_modules/@sentry/cli/sentry-cli releases new 072723aaad54a05109d88b2dba9ed10460fc3a35'
#18 6.595 }
#18 6.595
#18 6.595 Node.js v18.16.0
#18 6.606 ERROR: "build:sentry" exited with 1.
Any idea why I can’t get the CLI to pick up the environment variable? When I run the command on my machine (npm run build
) it works just fine when I set the variables in my .env file.