Cypress: Uncaught (in promise): TypeError: _angular_core__WEBPACK_IMPORTED_MODULE

Created on 17 Jan 2019  ยท  16Comments  ยท  Source: cypress-io/cypress

I'm getting this error when loading url in cypress but that url is working in a normal browser. can anyone explain by i'm getting this error.

ERROR Error: Uncaught (in promise): TypeError: _angular_core__WEBPACK_IMPORTED_MODULE_1__.๏ฟฝ๏ฟฝpid is not a function
TypeError: _angular_core__WEBPACK_IMPORTED_MODULE_1__.๏ฟฝ๏ฟฝpid is not a function
    at View_ScgeneralInformationComponent_0 (main.js:45806)
    at resolveDefinition (vendor.js:35355)
    at createViewNodes (vendor.js:38949)
    at callViewAction (vendor.js:39419)
    at execComponentViewsAction (vendor.js:39328)
    at createViewNodes (vendor.js:39013)
    at createRootView (vendor.js:38874)
    at callWithDebugContext (vendor.js:40299)
    at Object.debugCreateRootView [as createRootView] (vendor.js:39582)
    at ComponentFactory_.push../node_modules/@angular/core/esm5/core.js.ComponentFactory_.create (vendor.js:36479)
    at resolvePromise (polyfills.js:3153)
    at resolvePromise (polyfills.js:3110)
    at polyfills.js:3214
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:2745)
    at Object.onInvokeTask (vendor.js:29952)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:2744)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (polyfills.js:2517)
    at drainMicroTaskQueue (polyfills.js:2923)
    at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (polyfills.js:2824)
    at invokeTask (polyfills.js:4066)

Most helpful comment

@dudewad I've faced the same issue

Uncaught TypeError: _angular_core__WEBPACK_IMPORTED_MODULE_0__.๏ฟฝ๏ฟฝmpd is not a function

and got it resolved by changing IIS settings of my local site - instead of using http, I started using https. Maybe this will work for you as well.

Well, this helped to figure out that the error only happens when testing my Angular App: http://localhost:4200, thanks @lbarkan

But I'm still getting the same error ๐Ÿ˜ž :

Uncaught TypeError: _angular_core__WEBPACK_IMPORTED_MODULE_0__.๏ฟฝ๏ฟฝmpd is not a function

UPDATE1:
I've used a Self-Signed certificate to run my local Angular App with HTTPS, but I'm gettting the same error. Which means that changing from http to https didn't do the trick for me.

One other thing, I'm on Angular 8 now, and it was working fine in Angular 7.

UPDATE 2: Solved!
Looks like I needed these two options in angular.json, in the configurations options:
"aot": true,
"buildOptimizer": true,

Like this:

"testing": {
  "aot": true,
  "buildOptimizer": true,
  "fileReplacements": [
    {
      "replace": "src/environments/environment.ts",
      "with": "src/environments/environment.testing.ts"
    }
  ]
}

(I hope that helps anyone with the same problem)

All 16 comments

Same issue +1

Can either of you provide a way to reproduce this? Provide the test code with url to visit or test code + application code? Unfortunately we'll have to close the issue if we cannot reproduce the issue locally on our machine.

thanks for your reply,
Now, I'm not getting this error, before I'm getting this error but not every time.

Please comment if you experience this problem in the future and we'll consider reopening.

Just started showing up for me in gitlab runner. Not exactly the same, but similar. Running locally on macOS, no problem. In gitlab using the cypress/base:10 image the result below. Not sure what has changed, and definitely not clear this is a cypress problem. Just adding some information.

Regards, Mike

$ node $NODE_DEBUG_OPTION node_modules/.bin/ng e2e td-e2e --headless --prod
** Angular Live Development Server is listening on localhost:3000, open your browser on http://localhost:3000/ **

Date: 2019-02-05T09:08:40.765Z
Hash: 9d62c0b0dca7070345ed
Time: 75727ms
chunk {main} main.3457349e801598b99637.js (main) 19.6 MB [initial] [rendered]
chunk {polyfills} polyfills.7adb620860ed09aebdac.js (polyfills) 144 kB [initial] [rendered]
chunk {runtime} runtime.618bcded6741c4c27fdf.js (runtime) 6.04 kB [entry] [rendered]
chunk {scripts} scripts.8634aa323aa52b0c1fce.js (scripts) 2.1 MB  [rendered]
chunk {styles} styles.7abe7ed614da8390b1a5.css (styles) 556 kB [initial] [rendered]
โ„น ๏ฝขwdm๏ฝฃ: Compiled successfully.
It looks like this is your first time using Cypress: 3.1.5

[09:08:40]  Verifying Cypress can run /builds/gui/green-js/cache/Cypress/3.1.5/Cypress [started]
[09:08:42]  Verifying Cypress can run /builds/gui/green-js/cache/Cypress/3.1.5/Cypress [completed]

Opening Cypress...

====================================================================================================

  (Run Starting)

  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ Cypress:    3.1.5                                                                              โ”‚
  โ”‚ Browser:    Electron 59 (headless)                                                             โ”‚
  โ”‚ Specs:      13 found (01-fixtures.spec.js, asset-user-info.spec.js, chart.spec.js, forms.specโ€ฆ โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

  Running: 01-fixtures.spec.js...                                                         (1 of 13) 


  Fixtures
    - dumps database into fixtures

    1) loads fixtures into database(s)


  0 passing (16s)
  1 pending
  1 failing

  1) Fixtures loads fixtures into database(s):
     _angular_core__WEBPACK_IMPORTED_MODULE_0__.๏ฟฝ๏ฟฝmpd is not a function

This error originated from your application code, not from Cypress.

When Cypress detects uncaught errors originating from your application it will automatically fail the current test.

This behavior is configurable, and you can choose to turn this off by listening to the 'uncaught:exception' event.

https://on.cypress.io/uncaught-exception-from-application
  TypeError: _angular_core__WEBPACK_IMPORTED_MODULE_0__.๏ฟฝ๏ฟฝmpd is not a function
      at http://localhost:3000/main.3457349e801598b99637.js:321212:23225
      at resolveDefinition (http://localhost:3000/main.3457349e801598b99637.js:110356:17)
      at NgModuleFactory_.push.../../node_modules/@angular/core/fesm5/core.js.NgModuleFactory_.create (http://localhost:3000/main.3457349e801598b99637.js:114117:43)
      at http://localhost:3000/main.3457349e801598b99637.js:107588:43
      at ZoneDelegate.push.../../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:3000/polyfills.7adb620860ed09aebdac.js:399:26)
      at Object.onInvoke (http://localhost:3000/main.3457349e801598b99637.js:107123:33)
      at ZoneDelegate.push.../../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:3000/polyfills.7adb620860ed09aebdac.js:398:52)
      at Zone.push.../../node_modules/zone.js/dist/zone.js.Zone.run (http://localhost:3000/polyfills.7adb620860ed09aebdac.js:158:43)
      at NgZone.push.../../node_modules/@angular/core/fesm5/core.js.NgZone.run (http://localhost:3000/main.3457349e801598b99637.js:107037:28)
      at PlatformRef.push.../../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModuleFactory (http://localhost:3000/main.3457349e801598b99637.js:107586:23)
      at HTMLDocument.<anonymous> (http://localhost:3000/main.3457349e801598b99637.js:321786:10)
      at HTMLDocument.wrapped (http://localhost:3000/main.3457349e801598b99637.js:292681:21)
      at ZoneDelegate.push.../../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:3000/polyfills.7adb620860ed09aebdac.js:431:31)
      at Zone.push.../../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:3000/polyfills.7adb620860ed09aebdac.js:203:47)
      at ZoneTask.push.../../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:3000/polyfills.7adb620860ed09aebdac.js:506:34)
      at invokeTask (http://localhost:3000/polyfills.7adb620860ed09aebdac.js:1752:14)
      at HTMLDocument.globalZoneAwareCallback (http://localhost:3000/polyfills.7adb620860ed09aebdac.js:1778:17)
      at http://localhost:3000/scripts.8634aa323aa52b0c1fce.js:28230:18
      at wrapped (http://localhost:3000/main.3457349e801598b99637.js:292681:21)
      at ZoneDelegate.push.../../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:3000/polyfills.7adb620860ed09aebdac.js:431:31)
      at Zone.push.../../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:3000/polyfills.7adb620860ed09aebdac.js:203:47)
      at push.../../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (http://localhost:3000/polyfills.7adb620860ed09aebdac.js:506:34)
      at ZoneTask.invoke (http://localhost:3000/polyfills.7adb620860ed09aebdac.js:495:48)
      at timer (http://localhost:3000/polyfills.7adb620860ed09aebdac.js:2289:29)




  (Results)

  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ Tests:        2                   โ”‚
  โ”‚ Passing:      0                   โ”‚
  โ”‚ Failing:      1                   โ”‚
  โ”‚ Pending:      1                   โ”‚
  โ”‚ Skipped:      0                   โ”‚
  โ”‚ Screenshots:  1                   โ”‚
  โ”‚ Video:        true                โ”‚
  โ”‚ Duration:     16 seconds          โ”‚
  โ”‚ Spec Ran:     01-fixtures.spec.js โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

@mike-packetwerk Can you provide a way to reproduce this? Provide the test code with url to visit or test code + application code?

@mike-packetwerk Can you provide a way to reproduce this? Provide the test code with url to visit or test code + application code?

Sorry, internal app. Angular CLI has recent problems due to terser - maybe this is related https://github.com/angular/angular-cli/issues/13582. When I upgrade CLI I'll report back if any change occurs.

Ok, so I haven't upgraded anything, and yet the cypress tests are working again in gitlab. I have no explanation, but an appreciation: I think you fine folks have made a wonderful tool with cypress. I am thankful, even if my environment is inexplicable.

@mike-packetwerk @amit-dhakad1
I just all of a sudden got the same issue. Did you guys ever find out how it was solved?

I don't know how that is solved.

@mike-packetwerk @amit-dhakad1
I just all of a sudden got the same issue. Did you guys ever find out how it was solved?

Even though we use yarn to nail our dependencies, it feels like something changed behind us. I don't have an explanation for the problem appearing, nor disappearing.

Our team is getting:
Uncaught TypeError: _angular_core__WEBPACK_IMPORTED_MODULE_0__.๏ฟฝ๏ฟฝmpd is not a function
Has anyone figured out the cause for this? We're stumped.
Also works locally for us, on Azure devops it fails.

Error
TypeError: _angular_core__WEBPACK_IMPORTED_MODULE_1__.๏ฟฝ๏ฟฝnov is not a function

Error appears randomly only in e2e tests.

Internal project.

"@angular/animations": "7.2.1",
"@angular/cdk": "^7.2.1",
"@angular/common": "7.2.1",
"@angular/compiler": "7.2.1",
"@angular/compiler-cli": "7.2.1",
"@angular/core": "7.2.1",
"@angular/forms": "7.2.1",
"@angular/http": "7.2.1",
"@angular/platform-browser": "7.2.1",
"@angular/platform-browser-dynamic": "7.2.1",
"@angular/platform-server": "7.2.1",
"@angular/router": "7.2.1",

"@angular-devkit/build-angular": "~0.12.0",
"@angular/cli": "^7.3.0",

We also use preloadingStrategy: PreloadAllModules,

Can it be the case that when some module is loading but not yet loaded and Cypress navigating to url that related to this module it somehow break loading process, or returning a module that not fully loaded yet?

Hi everyone! I've also faced this issue and the workaround that helped me to fix it is adding a strict version of the webpack to the dependencies sections of my package.json file (f.e, "webpack": "4.35.0")

@dudewad I've faced the same issue

Uncaught TypeError: _angular_core__WEBPACK_IMPORTED_MODULE_0__.๏ฟฝ๏ฟฝmpd is not a function

and got it resolved by changing IIS settings of my local site - instead of using http, I started using https. Maybe this will work for you as well.

@dudewad I've faced the same issue

Uncaught TypeError: _angular_core__WEBPACK_IMPORTED_MODULE_0__.๏ฟฝ๏ฟฝmpd is not a function

and got it resolved by changing IIS settings of my local site - instead of using http, I started using https. Maybe this will work for you as well.

Well, this helped to figure out that the error only happens when testing my Angular App: http://localhost:4200, thanks @lbarkan

But I'm still getting the same error ๐Ÿ˜ž :

Uncaught TypeError: _angular_core__WEBPACK_IMPORTED_MODULE_0__.๏ฟฝ๏ฟฝmpd is not a function

UPDATE1:
I've used a Self-Signed certificate to run my local Angular App with HTTPS, but I'm gettting the same error. Which means that changing from http to https didn't do the trick for me.

One other thing, I'm on Angular 8 now, and it was working fine in Angular 7.

UPDATE 2: Solved!
Looks like I needed these two options in angular.json, in the configurations options:
"aot": true,
"buildOptimizer": true,

Like this:

"testing": {
  "aot": true,
  "buildOptimizer": true,
  "fileReplacements": [
    {
      "replace": "src/environments/environment.ts",
      "with": "src/environments/environment.testing.ts"
    }
  ]
}

(I hope that helps anyone with the same problem)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tahayk picture tahayk  ยท  3Comments

egucciar picture egucciar  ยท  3Comments

igorpavlov picture igorpavlov  ยท  3Comments

scottcrowe picture scottcrowe  ยท  3Comments

rbung picture rbung  ยท  3Comments