Skip to content
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

sentry config issues #226

Closed
pimlie opened this issue Aug 26, 2020 · 11 comments · Fixed by #477
Closed

sentry config issues #226

pimlie opened this issue Aug 26, 2020 · 11 comments · Fixed by #477

Comments

@pimlie
Copy link
Member

pimlie commented Aug 26, 2020

Was looking at my sentry config and noticed a couple of issues

  • I'd like to add a whitelistUrls array to my config, but the options of this array are merged on every build. So after 3 builds my urls are all listed three times (in sentry.server.config.js)
  • Whitelist urls in Sentry should allow for regexp, but these arent correctly stringified atm. I tihnk we could check for value instanceof RegExp and then just call value.toString()?
  • Functions arent correctly stringified. Id like to try using sentry's user feedback feature but then you need to pass a beforeSend fn to your options. Nuxt should already provide a serializeFunction helper in the template context, maybe we could use that or did you use String for functions on purpose?
@pimlie
Copy link
Member Author

pimlie commented Aug 27, 2020

Looking at it a bit more maybe it doesnt matter at all because these props arent used when reading sentry.server.config.js?

@rchl
Copy link
Member

rchl commented Aug 27, 2020

  • I'd like to add a whitelistUrls array to my config, but the options of this array are merged on every build.

I was checking this out and there actually seems to be pretty bad issue that drops whitelistUrls (or any other customizations in config.serverConfig). The code in initSentry called from:

    this.nuxt.hook('listen', () => listenHook(this, options))

is overwriting config.serverConfig.

@rchl
Copy link
Member

rchl commented Aug 27, 2020

Well, as you said, it works in practice but still is kinda unexpected.

@rchl
Copy link
Member

rchl commented Aug 27, 2020

Whitelist urls in Sentry should allow for regexp, but these arent correctly stringified atm. I tihnk we could check for value instanceof RegExp and then just call value.toString()?

👍

  • Functions arent correctly stringified. Id like to try using sentry's user feedback feature but then you need to pass a beforeSend fn to your options. Nuxt should already provide a serializeFunction helper in the template context, maybe we could use that or did you use String for functions on purpose?

As you probably know, the core team discourages serialization of functions.
The options are:

  • override module's plugin by create a file in app/plugin-name.js
  • just creating a normal plugin that extends functionality (but maybe wouldn't work in this case)
  • (my favourite but not necessarily core's team favourite) assign a path to the option like beforeSend: '~/config/sentry-before-send.js' and import that within the module.

(see also internal discussion about that at https://discord.com/channels/473401852243869706/735157506300575775/747511148282118495 )

@pimlie
Copy link
Member Author

pimlie commented Aug 27, 2020

Thanks. Actually I dont have a big issue with serializing functions, at least not in how we should use them here as part of an external config object. I agree we should discourage it as much as possible and should look for a better way of passing module options in v3, but for v2 we shouldnt implement & spent time on implementations mostly for the sake of code purity. Especially when it only makes configuration more difficult and isnt rly needed for like 99% of the use-cases.

@ArnabBanerjee

This comment was marked as off-topic.

@bmulholland

This comment was marked as off-topic.

@rchl

This comment was marked as off-topic.

@ArnabBanerjee

This comment was marked as off-topic.

@ArnabBanerjee

This comment was marked as off-topic.

@rchl
Copy link
Member

rchl commented Dec 17, 2022

The first two points from the initial comment should be working just fine now.

The third point about serializing beforeSend should work too as far as I can tell. Unless the beforeSend needs to rely on something that is imported. Then serializing won't be enough and we would have to support specifying a file that exports a config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants