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

Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available) when including aws-amplify - lack of mjs file support #8361

Closed
DaveClissold opened this issue Aug 20, 2020 · 7 comments · Fixed by #8395
Assignees
Labels
type: regression A bug that didn't appear until a specific Cy version release v5.0.0 🐛 Issue present since 5.0.0

Comments

@DaveClissold
Copy link

DaveClissold commented Aug 20, 2020

Current behavior:

Have just upgraded to version 5.0.0 and it looks like there is a webpack config issue, missing *.mjs support, which is causing the @aws-amplify and graphql libraries from compiling. This worked in 4.12.1

aws-amplify/amplify-js#4299
graphql/graphql-js#1272

Error: Webpack Compilation Error
./node_modules/graphql/index.mjs 49:0-53:205
Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available)
 @ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js
 @ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js
 @ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js
 @ ./node_modules/aws-amplify/lib-esm/index.js
 @ ./cypress/support/custom/userLogin.ts
 @ ./cypress/support/custom/index.ts
 @ ./cypress/support/commands.ts
 @ ./cypress/support/index.ts
@jennifer-shehane
Copy link
Member

@DaveClissold Can you provide a full example for how you get this error please? Thanks!

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Aug 20, 2020
@DaveClissold
Copy link
Author

DaveClissold commented Aug 20, 2020

@jennifer-shehane I have a custom function to login to the AWS Cognito service, which uses the aws-amplify library.

import Amplify, { Auth } from 'aws-amplify';


Amplify.configure({
  Auth: {
    region: Cypress.env('AWS_REGION'),
    userPoolId: Cypress.env('AWS_USERPOOLID'),
    userPoolWebClientId: Cypress.env('AWS_USERPOOLWEBCLIENTID'),
  }
})

export const awsLogin = async () => {
  const username = Cypress.env('TEST_USERNAME');
  const password = Cypress.env('TEST_PASSWORD')
  try
    {
      const user = await Auth.signIn(username, password);
      return user
    } 
  catch (error)
    {
      console.log('error signing in', error);
    }
}

Aws-amplify relies on graphql queries, whose library 'very kindly' uses .mjs files.

I get the error when launching the test. It fails during the loading of the test

@chrisbreiding chrisbreiding self-assigned this Aug 20, 2020
@jebendfds
Copy link

Same thing here. Also using amplify.

@liadb
Copy link

liadb commented Aug 23, 2020

Same issue when upgrading to Cypress 5 and using amplify

@jennifer-shehane
Copy link
Member

I can recreate the error when including aws-amplify:

Repro

cypress/support/index.js

import Amplify from 'aws-amplify'

package.json

{
  "devDependencies": {
    "aws-amplify": "^3.0.24",
    "cypress": "5.0.0"
  }
}

4.12.1

The aws-amplify takes a really long time to load normally. see #7464

Screen Shot 2020-08-24 at 4 23 48 PM

5.0.0

Screen Shot 2020-08-24 at 4 21 06 PM

@jennifer-shehane jennifer-shehane changed the title Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available) Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available) when including aws-amplify Aug 24, 2020
@cypress-bot cypress-bot bot added stage: ready for work The issue is reproducible and in scope and removed stage: needs information Not enough info to reproduce the issue labels Aug 24, 2020
@jennifer-shehane jennifer-shehane added v5.0.0 🐛 Issue present since 5.0.0 type: regression A bug that didn't appear until a specific Cy version release labels Aug 24, 2020
@cypress-bot cypress-bot bot added stage: work in progress and removed stage: ready for work The issue is reproducible and in scope labels Aug 24, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 25, 2020

The code for this is done in cypress-io/cypress#8395, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@jennifer-shehane jennifer-shehane changed the title Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available) when including aws-amplify Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available) when including aws-amplify - lack of mjs file support Aug 26, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 1, 2020

Released in 5.1.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v5.1.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Sep 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: regression A bug that didn't appear until a specific Cy version release v5.0.0 🐛 Issue present since 5.0.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants