question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RegEx in tracingOrigins config breaks ember build

See original GitHub issue

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/ember

SDK Version

7.14.1

Framework Version

ember 4.7.0

Link to Sentry event

No response

Steps to Reproduce

  1. Create new app using ember-cli 4.7.0 ember new ember-quickstart --lang en
  2. install sentry SDK ember install @sentry/ember
  3. add config to config/environment.js, make sure to include RegEx in tracingOrigins, e.g.
  ENV['@sentry/ember'] = {
    sentry: {
      tracesSampleRate: 1.0,
      debug: false,
      browserTracingOptions: {
        tracingOrigins: [
          'localhost',
          /^\//,
        ],
      },
    },
  };
  1. 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:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mydeacommented, Oct 19, 2022

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.

1reaction
k-fishcommented, Oct 7, 2022

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 via Sentry.init?

@AbhiPrasad, we should probably have a deprecated warning for passing the sentry options via config, considering it’s come up before.

Read more comments on GitHub >

github_iconTop 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 >
@sentry/hub | Yarn - Package Manager
Fast, reliable, and secure dependency management.
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found