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

Amplify is totally crashed because of the Window is not defined error in youtube-iframe package #3506

Closed
svenkatesh-nyros opened this issue Jun 21, 2019 · 8 comments · Fixed by #3512
Assignees
Labels
bug Something isn't working UI Related to UI Components

Comments

@svenkatesh-nyros
Copy link

svenkatesh-nyros commented Jun 21, 2019

@powerful23, @robbevan ,@mlabieniec, @jordanranz, @mbahar, @richardzcode
After installation of the @aws-amplify with the additional package of youtube-iframe.

Getting the error of window is not defined in

  1. node_modules/youtube-iframe/index.js 50:3
  2. node_modules/@aws-amplify/ui/dist/aws-amplify-ui.js:1

Can you please provide the previous working version without facing the issue of window is not defined in the following folders.

1
2

@johnhamelink
Copy link

johnhamelink commented Jun 21, 2019

We're also experiencing this - we're using amplify as the basis for a nodejs SDK we're building, and upgrading from 1.1.27 to 1.1.29 produces this error for this. To add insult to injury, there's no changelog to be found, so it wasn't clear what caused this without looking into the codebase!

  • Please do: use semantic versioning properly so that we can upgrade this package in confidence - this should've been a minor upgrade as you introduced new packages which changed base requirements of the library.
  • Please do: seriously consider adding a changelog so that other libraries which depend on this can track changes more easily.
  • Please don't: assume that this library is only being used in the browser

Edit: I can confirm that reverting to 1.1.28 resolves this issue for us.

@sammartinez sammartinez added the UI Related to UI Components label Jun 21, 2019
@sammartinez sammartinez added the to-be-reproduced Used in order for Amplify to reproduce said issue label Jun 21, 2019
@sammartinez sammartinez assigned mlabieniec and unassigned jordanranz Jun 21, 2019
@mlabieniec
Copy link
Contributor

amplify-js is specifically a client / mobile / web library and does not have official support for node.js. For the iframe issue, we are aware of an issue/bug in analytics that should fix this in: https://www.npmjs.com/package/@aws-amplify/analytics/v/1.2.18-unstable.0

@svenkatesh-nyros can you give this version a try and see if this fixes your issue. We will review this and make sure we add this case to our integration tests.

On the subject of node.js, we can add some documentation around how to get things working properly in node (via isomorphic fetch etc.), but at the moment our team efforts are focused on mobile/web client use cases. We are however investigating node support specifically for SSR.

@sammartinez sammartinez removed the to-be-reproduced Used in order for Amplify to reproduce said issue label Jun 21, 2019
@mlabieniec mlabieniec added the bug Something isn't working label Jun 21, 2019
@johnhamelink
Copy link

@mlabieniec we ended up stripping out all of amplify and replacing it with just @aws-amplify/auth - we're only using amplify to gain Cognito user credentials we can use to access other AWS products with.

@ajhool
Copy link

ajhool commented Jun 22, 2019

Due to Amplify's stated goal of SSR compatibility, we assumed that no new server-breaking changes would be added to the codebase. While Amplify might not yet officially support SSR, can there please at least be a moratorium on new server-side-breaking code? At the very least, a moratorium on new code that breaks the server at import-time of the package that contains that piece of code, even if some pieces of Amplify won't properly execute on the server?

For anybody with this problem, my resolution for similar issues with this package was to dynamically import amplify on the client side via a dynamic import in onComponentDidMount.

@aldegoeij
Copy link

@mlabieniec understanding of the mobile/web focus, however e.g. gatsby build for generating static web site is currently breaking as amplify on import of youtube-iframe is not defining window.

@aldegoeij
Copy link

@mlabieniec issue still exists on aws-amplify@1.1.30-unstable.1 and aws-amplify-react@2.3.10-unstable.1

@aldegoeij
Copy link

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

@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working UI Related to UI Components
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants