@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
Can you please provide the previous working version without facing the issue of window is not defined in the following folders.
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!
Edit: I can confirm that reverting to 1.1.28 resolves this issue for us.
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.
@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.
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
.
@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.
@mlabieniec issue still exists on [email protected]
and [email protected]
referencing tickets #3486, #3506, #3615, #3015, #876, #3477 and webpack/webpack#6522
Most helpful comment
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
.