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.

[Help Needed] ZoneAwarePromise `(window|global).Promise` has been overwritten

See original GitHub issue

Hi, I got Storybook successful setup with Angular 7 on a MacOS 10.14.5, but couldn’t get Storyshots working.

Below is the error I got, as you can see, my other Jest tests were running fine without any problems, but Storyshots won’t generate snapshots from the stories, looks like global[“Promise”] was overwritten by es.promise.js.

I tried fiddling around with the files in node_modules/@storybook/addon-storyshots/dist/frameworks/angular/loader.js, and make sure zone.js was imported after es.promise.js, but still no avail.

Any clues? Thanks!

...

  ● Storyshots › Another Button › button with link to another story

    Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.
    Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)

      at Function.Object.<anonymous>.Zone.assertZonePatched (node_modules/zone.js/dist/zone.js:58:23)
      at new NgZone (../packages/core/src/zone/ng_zone.ts:123:10)
      at TestBedViewEngine._initIfNeeded (../../packages/core/testing/src/test_bed.ts:408:20)
      at TestBedViewEngine.createComponent (../../packages/core/testing/src/test_bed.ts:594:10)
      at Function.TestBedViewEngine.createComponent (../../packages/core/testing/src/test_bed.ts:247:36)
      at _testing.TestBed.compileComponents.then (node_modules/@storybook/addon-storyshots/dist/frameworks/angular/renderTree.js:56:35)
      at node_modules/@storybook/addon-storyshots/node_modules/core-js/modules/es.promise.js:105:22
      at flush (node_modules/@storybook/addon-storyshots/node_modules/core-js/internals/microtask.js:26:9)

Test Suites: 1 failed, 18 passed, 19 total
Tests:       8 failed, 126 passed, 134 total
Snapshots:   0 total
Time:        28.119s, estimated 30s
Ran all test suites.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:29 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
iMarvcommented, Aug 7, 2019

Just gonna bump it as this is a serious issue for us.

4reactions
declinecommented, Jul 30, 2021

Thank you @xemlock, I had the exact same issue on Firefox and Safari (while it worked on Chrome).

I had to put the code in .storybook/webpack.config.js though:

module.exports = async ({ config, mode }) => {
  // Make whatever fine-grained changes you need
  config.resolve = config.resolve || {};
  config.resolve.alias['core-js/modules/es.promise.js$'] = false;

  // Return the altered config
  return config;
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unhandled promise rejection: Zone.js has detected that ...
Unhandled promise rejection: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten · There's no necessity to ...
Read more >
Zone.js has detected that ZoneAwarePromise `(window|global ...
js has detected that ZoneAwarePromise (window|global).Promise has been overwritten. Most likely cause is that a Promise polyfill has been loaded after Zone.js ( ......
Read more >
Zone.js has detected that ZoneAwarePromise `(window|global ...
Error: "Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten. Most likely cause is that a Promise ...
Read more >
Angular 2 Universal Starter - Heroku Elements
Promise ` has been overwritten. It occurs because Zone.js Promise implementation is not detected as Promise by some polyfills (e.g. es6-promise before 4.x)....
Read more >
Zone.js has detected that ZoneAwarePromise `(window|global ...
Promise has been overwritten. Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not ...
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