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

Error while running amplify pull in headless mode #5228

Closed
fkoner opened this issue Sep 2, 2020 · 6 comments · Fixed by #5233
Closed

Error while running amplify pull in headless mode #5228

fkoner opened this issue Sep 2, 2020 · 6 comments · Fixed by #5233
Labels
bug Something isn't working platform Issues tied to the general CLI platform

Comments

@fkoner
Copy link

fkoner commented Sep 2, 2020

Describe the bug
While executing the pull command using the headless configuration, the following error occurs:

2020-09-02T17:27:13.675Z [INFO]: TypeError: Cannot convert undefined or null to object
                                 at Function.assign (<anonymous>)
                                 at confirmFrameworkConfiguration (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-frontend-javascript/lib/configuration-manager.js:102:12)
                                 at confirmConfiguration (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-frontend-javascript/lib/configuration-manager.js:69:9)

Amplify CLI Version
4.28.1

To Reproduce

  1. Export environment variables:
export REACTCONFIG={"SourceDir":"src","DistributionDir":"build","BuildCommand":"yarn run build","StartCommand":"yarn run start"}
export AWSCLOUDFORMATIONCONFIG={"configLevel":"project","useProfile":true,"profileName":"default"}
export AMPLIFY={"projectName":"headlessProjectName","appId":"xxxxxxxxxxxxxx","envName":"dev","defaultEditor":"code"}
export FRONTEND={"frontend":"javascript","framework":"react","config":{"SourceDir":"src","DistributionDir":"build","BuildCommand":"yarn run build","StartCommand":"yarn run start"}}
export PROVIDERS={"awscloudformation":{"configLevel":"project","useProfile":true,"profileName":"default"}}
  1. Run ampliy pull with exported variables:
amplify pull \
  --amplify $AMPLIFY \
  --frontend $FRONTEND \
  --providers $PROVIDERS \
  --yes

Expected behavior
Ensure that the amplify pull command is executed. For previous versions (e.g. version 4.28.0) it has worked correctly.

Screenshots
amplify-issue

Desktop (please complete the following information):

  • OS: [Ubuntu, MacOSX]
  • Node Version: 10.20.1 (local) 10.16.0 (amplify console)

Additional context
The script we are dealing with is very similar to this:
https://docs.amplify.aws/cli/usage/headless#sample-script-3

The bug appears both in our local environment and in the amplify console, it is related to the command line, and not a bug associated to the amplify console.

I don't know if something changed between version 4.28.0 and version 4.28.1, but with this patch we were presented with this error this morning.

If you require more detail I can share my headless script.

Thanks in advance.
Paco

@akshbhu
Copy link
Contributor

akshbhu commented Sep 2, 2020

Hi @fkoner

I tried with the sample script and demo project and it is working fine for me. Can you elaborate more on following points:

  • Is it working for you in version 4.28.0?
  • Can you tell the details what resources you have added before so that I can repro this issue?

@akshbhu akshbhu added pending-response Issue is pending response from the issue author pending-triage Issue is pending triage platform Issues tied to the general CLI platform labels Sep 2, 2020
@cristhian-boc
Copy link

cristhian-boc commented Sep 2, 2020

There is a bug on the CLI. We are getting the following error: Unsupported javascript framework: react-native. I can see that somebody changed the framework-config-mapping.js file. You are not returning the configs as in the past.

Before:
image

Current:
image

And the configuration-manager.js file is trying to read the keys from that module.exports:

if (!Object.keys(frameworkConfigMapping).includes(inputParams.framework.toLowerCase())) {
      context.print.warning(`Unsupported javascript framework: ${inputParams.framework}`);
      inputParams.framework = 'none';
    }

So that is a breaking change, and maybe is the answer to solve this issue too.

This is our config for the frontend configuration:

FRONTEND="{\
\"frontend\":\"javascript\",\
\"framework\":\"react-native\",\
\"config\":$REACTCONFIG\
}"

We will use @4.26.0 in the meantime.

@fkoner
Copy link
Author

fkoner commented Sep 2, 2020

@akshbhu

I updated the issue, sorry, is not working in version 4.28.1, in previous version 4.28.0 it works.

@akshbhu
Copy link
Contributor

akshbhu commented Sep 2, 2020

Yup , I have reproduced this . Thanks for your insights @cristhian-boc

@akshbhu akshbhu added bug Something isn't working and removed pending-triage Issue is pending triage labels Sep 2, 2020
@fkoner
Copy link
Author

fkoner commented Sep 2, 2020

@akshbhu
@cristhian-boc
These commits

5debb76

bb06162

@yuth yuth removed the pending-response Issue is pending response from the issue author label Sep 2, 2020
yuth added a commit to yuth/amplify-cli that referenced this issue Sep 2, 2020
Updated the headless pull to use the updated framework detection methods

fix aws-amplify#5228
yuth added a commit to yuth/amplify-cli that referenced this issue Sep 18, 2020
Updated the headless pull to use the updated framework detection methods

fix aws-amplify#5228
yuth added a commit that referenced this issue Sep 18, 2020
Updated the headless pull to use the updated framework detection methods

fix #5228
r0zar pushed a commit to r0zar/amplify-cli that referenced this issue Nov 19, 2020
Updated the headless pull to use the updated framework detection methods

fix aws-amplify#5228
@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 for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working platform Issues tied to the general CLI platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants