bugsnag-js: Error 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode

Getting this weird error randomly in my app.

'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
Screenshot 2019-06-24 20 51 45

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Hi @hassanasad. I’m able to reproduce this but only when I set “strict mode” on the entire script and I attempt to notify Bugsnag with something that isn’t an error (and so is missing the .stack property).

How is your code being bundled? Which browsers are you seeing this in?

I think we can be defensive about not trying to walk the call stack when we’re in strict mode but I’d like to understand the situations where this happens first.

So comparing the differences between a project running Angular 8.0.2 vs. 8.1.0 it looks like the bundling is exactly the same, but the script tag that gets rendered in index.html changed like this:

+ <script src="vendor.js" type="module"></script>
- <script src="vendor.js"></script>

I can’t pinpoint the exact change in Angular (I think it’s in @angular/cli somewhere).

When the script attribute type="module" is used, this causes the entire script to be executed in strict mode. I can envisage this breaking any other vendored modules that expect to run in non-strict mode (I’m sure there are some) so it would be good to file an issue with Angular too if you can find the right place.

We’ll update Bugsnag so it tolerates being bundled into a strict mode context and I’ll let know when that gets released.

Thanks again for providing the steps to reproduce, it really helps to understand the cause of the issue and helps make sure we address it properly! 🙇

I just create a pr which can reproduce the problem: https://github.com/bugsnag/angular-debug-issue-546/pull/2

Run

npm start

And you will see the error. I think it relates to angular version.