Amplify-js: Window is not defined for amplify @ 1.1.29

Created on 18 Jun 2019  路  4Comments  路  Source: aws-amplify/amplify-js

I have problem for use aws-amplify. Why the amplify message show

/home/backend/Documents/node_modules/youtube-iframe/index.js:50
}(window));
^

ReferenceError: window is not defined
at Object. (/home/backend/node_modules/youtube-iframe/index.js:50:3)
at Module._compile (module.js:577:32)
at Module._extensions..js (module.js:586:10)
at Object.require.extensions.(anonymous function) [as .js]

(/home/backend/Documents/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object. (/home/backend/node_modules/@aws-amplify/analytics/src/Providers/AmazonPersonalizeHelper/MediaAutoTrack.ts:13:1)
at Module._compile (module.js:577:32)
at Module._extensions..js (module.js:586:10)
at Object.require.extensions.(anonymous function) [as .js]

(/home/backend/Documents/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)

When I put command NPM START. Why aws-amplify installed youtube-iframe?

Analytics bug

Most helpful comment

I am also having this issue, but only on a build machine. I am trying to narrow it down to a version of either @aws-amplify or aws-sdk, but no luck so far.

I'll report back if I succeed.

EDIT: Ok, the issue is caused by the latest @aws-amplify/analytics. Revert back to 1.2.16 for that package and the issue will be fixed. You can take a look at the available versions here: https://www.npmjs.com/package/@aws-amplify/analytics?activeTab=versions

If anyone's interested, this file - https://github.com/aws-amplify/amplify-js/blob/master/packages/analytics/src/Providers/AmazonPersonalizeHelper/MediaAutoTrack.ts - added a reference to youtube-iframe, which causes the issue here.

All 4 comments

I'm having the same issue.

I am also having this issue, but only on a build machine. I am trying to narrow it down to a version of either @aws-amplify or aws-sdk, but no luck so far.

I'll report back if I succeed.

EDIT: Ok, the issue is caused by the latest @aws-amplify/analytics. Revert back to 1.2.16 for that package and the issue will be fixed. You can take a look at the available versions here: https://www.npmjs.com/package/@aws-amplify/analytics?activeTab=versions

If anyone's interested, this file - https://github.com/aws-amplify/amplify-js/blob/master/packages/analytics/src/Providers/AmazonPersonalizeHelper/MediaAutoTrack.ts - added a reference to youtube-iframe, which causes the issue here.

I found that I also get this error from @aws-amplify/ui. If you are using yarn you can resolve the sub dependencies to earlier versions by adding resolutions to the package.json:

  "resolutions": {
    "@aws-amplify/analytics": "1.2.16",
    "@aws-amplify/ui": "1.0.19"
  },

referencing tickets #3486, #3506, #3615, #3015, #876, #3477 and webpack/webpack#6522

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oste picture oste  路  3Comments

cgarvis picture cgarvis  路  3Comments

karlmosenbacher picture karlmosenbacher  路  3Comments

ldgarcia picture ldgarcia  路  3Comments

cosmosof picture cosmosof  路  3Comments