-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account
Package + Version
-
@sentry/browser -
@sentry/node -
raven-js -
raven-node(raven for node) - other:
@sentry/nextjs
Version:
6.5.1
Description
I use Github Actions to build my nextjs application, then deploy artifacts to a NodeJS Server hosted elsewhere.
https://nextjs.org/docs/deployment#nodejs-server
During npm run build @sentry/nextjs creates a file .env.local and sets an environment variable SENTRY_SERVER_INIT_PATH. The value of said variable is an absolute path i.e. C:\some_path_to_project\.next\server\sentry\initServerSDK.js
During npm run start process.env.SENTRY_SERVER_INIT_PATH is used to require initServerSDK.js. However, npm run start is called after artifacts have been uploaded to a different environment running a NodeJS server. Because of this, the absolute path of process.env.SENTRY_SERVER_INIT_PATH is no longer valid.
initServerSDK.js cannot be found and Sentry.Init() is never called - serverside logging does not happen.
Source code
| setRuntimeEnvVars(projectDir, { SENTRY_SERVER_INIT_PATH: serverSDKInitOutputPath }); |
| require(process.env.SENTRY_SERVER_INIT_PATH as string); |