Amplify-js: Error on App start - Cannot read property 'prototype' of undefined

Created on 18 Sep 2018  路  4Comments  路  Source: aws-amplify/amplify-js

Im buildingnext.js` app.
And till yesterday everything work fine,
but today i updated 2 packages:

aws-amplify to 1.1.1
aws-amplify-react to 2.0.2

And from this moment i cannot start the app, i mean i receive an error in console:

{ TypeError: Cannot read property 'prototype' of undefined
at Object. (../../../src/vendor/dom-utils/matches.ts:5:32)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (../../../src/vendor/dom-utils/closest.ts:5:0)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18) sourceMapsApplied: true }

TypeError: Cannot read property 'prototype' of undefined
at Object. (/Users/eugenealitz/projects/proposalis-aws/node_modules/@aws-amplify/analytics/lib/vendor/dom-utils/matches.js:6:31)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/Users/eugenealitz/projects/proposalis-aws/node_modules/@aws-amplify/analytics/lib/vendor/dom-utils/closest.js:6:17)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
TypeError: Cannot read property 'prototype' of undefined
at Object. (/Users/eugenealitz/projects/proposalis-aws/node_modules/@aws-amplify/analytics/lib/vendor/dom-utils/matches.js:6:31)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/Users/eugenealitz/projects/proposalis-aws/node_modules/@aws-amplify/analytics/lib/vendor/dom-utils/closest.js:6:17)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)

TypeError: Cannot read property 'prototype' of undefined
at Object. (/Users/eugenealitz/projects/proposalis-aws/node_modules/@aws-amplify/analytics/lib/vendor/dom-utils/matches.js:6:31)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/Users/eugenealitz/projects/proposalis-aws/node_modules/@aws-amplify/analytics/lib/vendor/dom-utils/closest.js:6:17)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)

TypeError: Cannot read property 'prototype' of undefined
at Object. (/Users/eugenealitz/projects/proposalis-aws/node_modules/@aws-amplify/analytics/lib/vendor/dom-utils/matches.js:6:31)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/Users/eugenealitz/projects/proposalis-aws/node_modules/@aws-amplify/analytics/lib/vendor/dom-utils/closest.js:6:17)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)

Tried to rollback this packages, also removing /node_modules folder at all with no success

investigating

Most helpful comment

same issue on running gatsby develop
downgrading just only @aws-amplify/analytics to 1.0.9 with yarn resolutions directive:

  "resolutions": {
    "@aws-amplify/analytics" : "1.0.9"
  },

solved for me the issue

All 4 comments

same issue on running gatsby develop
downgrading just only @aws-amplify/analytics to 1.0.9 with yarn resolutions directive:

  "resolutions": {
    "@aws-amplify/analytics" : "1.0.9"
  },

solved for me the issue

@shurik239 thank you, you save my day

For those of us still on the workaround- as of 1.0.6 you now need to also hold @aws-amplify/core back too:

  "resolutions": {
    "@aws-amplify/analytics": "1.0.9",
    "@aws-amplify/core": "1.0.9"
  },

@psycura were you able to make any progress on marrying next.js and amplify? If so, can you please share what you have done to make auth to work?

Was this page helpful?
0 / 5 - 0 ratings