Skip to content

Conversation

@s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Oct 18, 2024

DESCRIBE YOUR PR

Updates the docs for the @sentry/nuxt beta release

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.): 18. Oct
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

@s1gr1d s1gr1d requested a review from Lms24 October 18, 2024 13:45
@vercel
Copy link

vercel bot commented Oct 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
changelog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 8:38am
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 8:38am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
develop-docs ⬜️ Ignored (Inspect) Visit Preview Oct 21, 2024 8:38am

@codecov
Copy link

codecov bot commented Oct 21, 2024

Bundle Report

Changes will decrease total bundle size by 15 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-server-cjs 7.52MB 6 bytes (-0.0%) ⬇️
sentry-docs-edge-server-array-push 257.08kB 3 bytes (-0.0%) ⬇️
sentry-docs-client-array-push 6.44MB 6 bytes (-0.0%) ⬇️

Comment on lines 55 to 70
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
```
Copy link
Contributor

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.

Copy link
Member Author

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.

@s1gr1d s1gr1d requested a review from chargome October 21, 2024 09:14
@s1gr1d s1gr1d merged commit 500a1f3 into master Oct 21, 2024
11 checks passed
@s1gr1d s1gr1d deleted the sig/nuxt-beta-manual-setup branch October 21, 2024 11:54
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants