-
Notifications
You must be signed in to change notification settings - Fork 0
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
[JavaScript] Nuxt SDK #20
Comments
See getsentry#6929 |
If you need insights from the Nuxt team at any time, please don't hesitate to reach out! 🙏 |
Click the checkbox below to generate a PR!
@hiroshinishio, You have 2 requests left in this cycle which refreshes on 2024-11-04 02:56:25+00:00. |
Click the checkbox below to generate a PR!
@hiroshinishio, You have 3 requests left in this cycle which refreshes on 2024-11-05 22:45:17+00:00. |
This is such a great news! It would be ideal that it would work on all envs. It would be great if |
Thanks for the input! Which libraries do you mean with "not all libraries are compatible"? |
Hi , I don't have an extensive list, but for example AJV doesn't work. Workers don't use node, they use their own runtime (workerd) which is limited to web standards (similarly to deno). I think if you use only |
This is of course for the backend part of nuxt, i.e. nitro. On the frontend sentry/vue should work perfectly. |
I use Sentry on my APIs (fullstack Nuxt 3 deployment to Cloudflare pages) with the sentry/browser package on the API side to get around edge restrictions. The context Sentry devs, for cosbgn's comment, is that Nuxt 3 was built with the "deploy anywhere" ethos, so all the core packages and (new) community modules are designed to be runtime agnostic. That's where https://unjs.io/ was born from. I initially followed this guide if it helps at all with the PR in general https://www.lichter.io/articles/nuxt3-sentry-recipe (written by a core Nuxt 3 dev) |
While we may not support worker (WinterCG) runtimes from the start we will look into it eventually. We are planning to release the SDK iteratively and in stages. Prioritization of worker runtime support depends of course a bit on the demand. I added an item to the list to track. Technically we have all the building blocks available. |
I don't have any specific data, but from my understanding a big percent of nuxt apps are deployed on the edge (vercel-edge, workers, netlify edge, etc) as you get better performance for lower costs, and Nuxt pretty much "guarantees" that it will work on the edge, so it's an obvious solution. I understand if you decide not to prioritize it, I just wanted to let you know that it would be great to have it from day one. It might be as simple as using sentry/core rather than sentry/node (I don't know, just an example). Anyways, thanks for the first party package, love sentry and I would love to be able to add it to Nuxt easily! |
Great initiative! Could we also make sure that errors before the hydration are also handled? |
We want to monitor as many as possible. The first release of the SDK will cover monitoring the majority of errors and we will definitely improve it over time |
It would be great if this module could integrate |
matching how our SvelteKit SDK works with vite plugin and our Next.js SDK works with our webpack plugin, we'll definitely have 1st class integration with the vite plugin in the Nuxt SDK! For now you can use the sentry wizard which will automatically add the vite plugin to your vite config, but you'll still have to supply the options yourself.
|
Hi, great initiative! Is there any ETA on this project? 🙂 |
Good news 🎉 You can already use the Nuxt SDK, there should not be breaking changes as of now. Version 8.23.0 is a good version to start using it and it offers new enhancements like filtering out transactions of build assets ( I would say it is in late alpha state as some features are still being implemented/tested and by having people already using the SDK we can get a solid understanding of which features are still missing or not working correctly. |
Awesome, good news indeed! Thank you! |
Maybe this is not the place to ask, feel free to delete, but I can't get past the part where you import the instrument when running
Any ideas?
--- EDIT --- I tried it on a clean project and it seems to work fine, so there's something up in my project! --- EDIT 2 --- Fixed with:
|
Thanks for reporting! Please open a new issue as it helps us avoid some back and fourth asking what you did and how you set up the SDK and so on. We'll take a look! |
Any updates on when sourcemap support will be added to the SDK? |
Source maps should already work for the client-side issues (docs here). Server-side source maps are coming soon. |
"Add an --import flag to the NODE_OPTIONS environment variable wherever you run your application. For local previews, update your nuxt preview script in the package.json (see below). Also, ensure this environment variable is set in your deployment environment, such as on Netlify or Vercel." Does this mean i should add it "build": "NITRO_PORT=4000 NITRO_HOST=0.0.0.0 nuxt build", To all of these?? |
Would be great if, within the https://nuxt.com/docs/api/composables/use-runtime-config Example from other module: The code below import * as Sentry from '/nuxt'
Sentry.init({
enabled: process.env.NUXT_PUBLIC_SENTRY_ENABLED,
}) Would then become: import * as Sentry from '/nuxt'
export default defineSentryConfig(() => {
const config = useRuntimeConfig()
Sentry.init({
enabled: config.public.sentry.enabled,
})
}) |
Ideally I'd prefer it if the |
you would have to update those two scripts:
Those scripts are using the generated build output of nuxt. The Sentry Nuxt SDK is optimized for the production build, so you only have to add it here. Without this, the server-part is not fully instrumented. We opted for having an external file as this gives you the possibility to pass functions like And thanks for providing the formkit example, this looks like a nice API. We are going to have a look at this and see if we can implement something like this as well! |
Hi , thank you for the hard work so far :-) I have two questions with regard to the server instrumentation:
|
Hey, thank you for your feedback! is out today, she can answer in more detail on Monday! I am not saying that the |
Yeah, because right now there is no way to use Nuxt public config right? |
It is in the About your 2. point: Do you mean creating a server-plugin yourself? The SDK already adds a server-plugin with the necessary hooks. But the initialization takes place in the |
Hi , can't we use late initiliazation to solve this? |
Yes, something like this could work. I am just trying different approaches. |
some feedback from someone testing out the Nuxt SDK. Some of this feedback i think holds true regarding the file requirements for config of most of our JS SDKs, especially the meta frameworks. running in dev, i notice that Nuxt has a dev tool bar, slightly (un)related but i wonder if Sentry could interact there? Like you could get more info about the error in browser in dev mode?
|
I tested it for server, i use startSpan but nothing sent to "Performance". |
thanks for trying out the SDK. Would you mind opening a new issue with reproduction steps? Thank you! |
Hello, Thank you for your work! I'm encountering two significant issues while integrating Sentry into my Nuxt.js project: 1 - Sourcemap Upload Fails on Staging: Local Build: When building the project locally, the sourcemap is successfully uploaded to Sentry. (
This may be due to server configuration, I will investigate 2 - Environment Variables Not Accessible: 3 - Attempted Solution with Nuxt Plugin: I attempted to create a custom Nuxt plugin to cleanly manage the Sentry configuration, but in this case, the sourcemap upload doesn’t even trigger as the file seems to be unrecognized. Thank you in advance for your feedback :) |
I transferred your comment into a separate issue because otherwise this issue is gonna get messy af |
Not sure what exactly from How I use Sentry in Nuxt currently (without frontend logging): nuxt.config.ts:
server/plugins/sentry.ts:
|
I don't know if this is of any help but nuxt scripts provides some options for better performance loading scripts (also npm scripts). Maybe adding a registry script could provide some features and help with the performance. |
I haven't tested Thanks for the input! I'm not quite sure how nuxt scripts can be used here. Perhaps you could explain a little more about how you thought this could be used in the SDK :) |
Hi, site maps are not being generated, or at least not being read correctly when viewing an error. Does Sentry automatically generate sitemaps via nuxt.config's sentry options (as listed in the docs), or is another command required? |
If there is an issue with the experimental SDK feel free to open a new issue in our repository as it makes it easier to keep track of things 🙌 I am not sure what you mean with "sitemaps" - we don't generate sitemaps. In case you mean source maps: Yes, they are generated and uploaded automatically if you provide the sourceMapsUploadOptions and you don't need another command :) |
So the idea is to optimize the page loading performance by using nuxt scripts and prevent possible errors with SSR. For example it provides a proxy object to track events and will fire them when it is fully set up.
and
But as mentioned before: I am not sure if it would be possible to adapt the logic so it could be integrated. |
Re: nuxt scripts. I think we need to look into it a bit further. Superficially I can say that the upside it gives is probably very slim since the Sentry SDK needs to load very early on in the pageload for a bunch of important features (errors, performance, replay). The DX is definitely an argument. For now, I think we'll try to focus on shipping a robust SDK without using nuxt scripts but there is nothing that prevents us from migrating to that pattern later on. (also note that nuxt scripts are in beta - to some degree atleast) |
@hiroshinishio Pull request completed! Check it out here #25 🚀 Note: I automatically create a pull request for an unassigned and open issue in order from oldest to newest once a day at 00:00 UTC, as long as you have remaining automation usage. Should you have any questions or wish to change settings or limits, please feel free to contact [email protected] or invite us to Slack Connect. |
Important
This issue is tracking progress on the Nuxt SDK. If you find bugs or problems with the
@sentry/nuxt
package please open a separate issue. Thank you!New SDK for https://nuxt.com/
There is an existing discussion: Sentry SDK for Nuxt
Nuxt uses nitro as their server, this means we'll need to have nitro support. It might make sense for us to create an OpenTelemetry instrumentation for nitro. It will also be valuable to add similar instrumentation for the other libraries Nuxt relies on:
The text was updated successfully, but these errors were encountered: