-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
docs(nuxt): Manual setup for beta #11614
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
platform-includes/getting-started-sourcemaps/javascript.nuxt.mdx
Outdated
Show resolved
Hide resolved
Bundle ReportChanges will decrease total bundle size by 15 bytes (-0.0%) ⬇️. This is within the configured threshold ✅ Detailed changes
|
| The Nuxt `useRuntimeConfig()` does not work in the Sentry server config due to technical reasons (the config file has to | ||
| be loaded before Nuxt is loaded). To be able to use `process.env` you either have to add `--env-file=.env` to your node command | ||
| or use the `dotenv` package: | ||
|
|
||
| ```bash {tabTitle: env-file} | ||
| node --env-file=.env --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs | ||
| ```bash {tabTitle: node} | ||
| node --env-file=.env .output/server/index.mjs | ||
| ``` | ||
|
|
||
| or use the `dotenv` package: | ||
|
|
||
|
|
||
| ```javascript {tabTitle: dotenv} {filename:sentry.server.config.ts} {1,4} | ||
| ```javascript {tabTitle: Server Config} {filename:sentry.server.config.ts} {1,3} | ||
| import dotenv from 'dotenv'; | ||
| import * as Sentry from '@sentry/nuxt'; | ||
|
|
||
| dotenv.config(); | ||
|
|
||
| Sentry.init({ | ||
| dsn: "___PUBLIC_DSN___" | ||
| }); | ||
| // ... rest of the file | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to act now - just sharing my thoughts: I don't think how users can pass env vars into their app shouldn't be in our documentation but idk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it because there's no need to do those extra steps when using Nuxt. Usually, you can use useRuntimeConfig(), where your env vars are set and process.env can be used without explicitly installing dotenv.
However, as the server-side config is loaded before any Nuxt code is loaded, the env setup has to be done manually.
DESCRIBE YOUR PR
Updates the docs for the
@sentry/nuxtbeta releaseIS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes: