-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[Nuxt] Look for SDK init files in Nuxt layers #14345
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
Comments
Hy, thanks for writing in. Supporting layers is still on the roadmap. What would be the ideal setup for you as a person using layers? |
@s1gr1d yes, setting up Sentry in the base layer was the approach I was going for. I can also imagine having some specific Sentry layer if a more granular layers approach is preferred, but I personally don't have a need for that. Since all applications use their own DSN some mechanism of overriding that is required. In addition we have a distinct version for each application, so we set that as well. We picked the One snag that I ran into was that in our monorepo multiple applications can be built from the same commit. Since I believe a release in Sentry needs to be unique I had to figure out a way to manually set a version in the build/sourcemap configuration (see also #14337) (I wasn't able to use the |
Thanks for sharing your usecase! I added this to the backlog for the Sentry Nuxt SDK. Please react with an emoji in the issue description as this helps us prioritize this. |
just stumbled upon the same problem - would be great it this works! |
Yea although it's not really a problem to copy paste this stuff around it would be greatly appreciated if the "latest" layer to the entry was the source of the build configuration. I may even indeed open up a PR for this if you want. It's really not so hard to implement. 30+ lines. at the start of the module :) |
Yeah, just adding support for the latest layer would actually be a good idea! If you want to contribute this, you can tag me as a reviewer. |
Added ability to detect and import config files from the **active** nuxt layer with strategy of the **most latest** layer taking precedence. Included fallback behavior for good measure. Rest of the config should be merged as it already is by c12 and defu. Don't think this PR covers the git:repo based layers but those are generally not full supported as well in Nuxt 3 ecosystem. Added basic tests Resolves [#14345](#14345) --------- Co-authored-by: Ivan Pesic <[email protected]>
A PR closing this issue has just been released 🚀This issue was referenced by PR #16372, which was included in the 9.23.0 release. |
Problem Statement
We use Nuxt layers to have a common base for multiple projects. After adding the @sentry/nuxt module and the client/server configuration files (
sentry.*.config.ts
) to the base layer I had a hard time figuring out why sourcemaps weren't uploaded and Sentry wasn't initialised in the applications based on this layer.Only after diving into
sentry-javascript/packages/nuxt/src/module.ts
Line 72 in d253621
sentry-javascript/packages/nuxt/src/vite/utils.ts
Line 9 in d253621
After I did that things started working as expected (I also moved/duplicated the sentry config key from the base layer to the apps nuxt.config file, not sure if that was necessary).
Solution Brainstorm
Either somehow involve layers into the resolution of these init files, or cleary document that layer based configuration is not supported.
The text was updated successfully, but these errors were encountered: