Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise): TypeError: _angular_core__WEBPACK_IMPORTED_MODULE #3156

Closed
amit-dhakad1 opened this issue Jan 17, 2019 · 15 comments
Closed

Comments

@amit-dhakad1
Copy link

amit-dhakad1 commented Jan 17, 2019

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)
@jennifer-shehane
Copy link
Member

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.

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Jan 23, 2019
@amit-dhakad1
Copy link
Author

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

@jennifer-shehane jennifer-shehane removed the stage: needs information Not enough info to reproduce the issue label Jan 31, 2019
@jennifer-shehane
Copy link
Member

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

@mike-packetwerk
Copy link

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 │
  └───────────────────────────────────┘

@jennifer-shehane
Copy link
Member

@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
Copy link

@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 angular/angular-cli#13582. When I upgrade CLI I'll report back if any change occurs.

@mike-packetwerk
Copy link

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.

@oleghansen
Copy link

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

@amit-dhakad
Copy link

I don't know how that is solved.

@mike-packetwerk
Copy link

@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.

@dudewad
Copy link

dudewad commented May 26, 2019

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.

@qialex
Copy link

qialex commented Jun 28, 2019

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?

@YevheniiaMazur
Copy link

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")

@lbarkan
Copy link

lbarkan commented Jul 30, 2019

@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.

@joaodarocha
Copy link

joaodarocha commented Oct 1, 2019

@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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants