RegEx in tracingOrigins config breaks ember build
See original GitHub issueIs there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
SDK Version
7.14.1
Framework Version
ember 4.7.0
Link to Sentry event
No response
Steps to Reproduce
- Create new app using ember-cli 4.7.0
ember new ember-quickstart --lang en
- install sentry SDK
ember install @sentry/ember
- add config to
config/environment.js
, make sure to include RegEx intracingOrigins
, e.g.
ENV['@sentry/ember'] = {
sentry: {
tracesSampleRate: 1.0,
debug: false,
browserTracingOptions: {
tracingOrigins: [
'localhost',
/^\//,
],
},
},
};
- run ember
ember serve
Expected Result
ember builds and runs app
Actual Result
build fails with error
non serializable item found in config: /^\//
[Embroider:MacrosConfig] the given config from '/YOUR_PATH/node_modules/@sentry/ember' for packageName 'undefined' is not JSON serializable.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Automatic Instrumentation for Ember - Sentry Documentation
After configuration, you will see both pageload and navigation transactions in sentry.io. ... The option can be configured for the built-in ember browser....
Read more >Using Regex with Flatfile's Data Importer in Ember
Validating your data using regular expressions with Flatfile and Ember. ... Below is a quick example of using the regex_matches validator to make...
Read more >RegEx in tracingOrigins config breaks ember build - PullAnswer
Hey @dagroe, the config will break since it only accepts serializable options. To have more advanced options, you'll probably need to initialize Sentry ......
Read more >Issues · getsentry/sentry-javascript · GitHub
RegEx in tracingOrigins config breaks ember build Misc: Help Wanted Package: ember Status: Backlog Type: Bug. #5903 opened 5 days ago by dagroe....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’d say both are possible.
We can also leverage (=copy) the validation that also happens in embroider (which, incidentally, I wrote there for exactly this issue 😂 see https://github.com/embroider-build/embroider/pull/1083). but, as you can see there, this is not entirely straightforward, and would also kind of duplicate all of this functionality/checks. But might be a bit more “user friendly” this way, as theoretically you may also want to set other config based on env (e.g. debug, or similar).
Anyhow, for me both approaches seem OK! The more user friendly would be to validate it and throw a nicer error message, I guess.
It should be fine using the regex as is recommended in the docs, using
Sentry.init
and calling it within the application. Using Ember config to pass Sentry options can’t serialize functions / objects etc. which is why the regex is breaking. Try switching to pass the Sentry options viaSentry.init
?@AbhiPrasad, we should probably have a deprecated warning for passing the
sentry
options via config, considering it’s come up before.