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

api/build//build/cloudformation-template.json and schema.graphql not created #13385

Closed
2 tasks done
dan-hook opened this issue Nov 2, 2023 · 10 comments
Closed
2 tasks done
Labels
multienv Issues tied to multiple environment feature in the CLI pending-triage Issue is pending triage

Comments

@dan-hook
Copy link

dan-hook commented Nov 2, 2023

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

v20.9.0

Amplify CLI Version

12.7.1, but also tried 11.1.1

What operating system are you using?

Ubuntu on WSL2

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes, but many custom resources in the application

Describe the bug

In a fresh checkout of my project, I run
amplify init --appId d1g66d3b03y7li
? Do you want to use an existing environment? Yes
? Choose the environment you would like to use: qa
Using default provider awscloudformation
✔ Initialized provider successfully.
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
✅ Initialized your environment successfully.

Then I run amplify push, which operates normally, but it gets to:
✔ Are you sure you want to continue? (Y/n) · yes
Installing dependencies from Pipfile.lock (ca2f74)...
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Could not read cloudformation template at path: /workspaces/gene-panel-api/project/amplify/backend/api/genepanelapi/build/cloudformation-template.json

Additionally, api/project/amplify/backend/api/genepanelapi/build/schema.graphql is also not created, which means codegen won't work.

WORKAROUND
If I edit my schema.graphql to add an extra line, everything works as expected.
I could also probably copy the files from current-cloud-backend.

Expected behavior

If the api/build directory is missing, it should be rebuilt completely, including schema.graphql and cloudformation-template.json.

This originally came up because I'm deploying this app in Github Actions. I checkout the code, push it, then use the generated typescript queries and mutations to run tests on the deployed API. There's value in running the tests even if schema.graphql hasn't changed because some of the Lambda functions that back the resolvers may have changed.

Reproduction steps

Create an amplify app with a graphql API. Deploy it. Commit to git (using the default .gitignore ) that leaves out the build directory. Check it out into a fresh directory, and run amplify init and amplify push as described in the bug.

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@dan-hook dan-hook added the pending-triage Issue is pending triage label Nov 2, 2023
@ykethan
Copy link
Member

ykethan commented Nov 3, 2023

Hey @dan-hook, thank you for reaching out. Could you run amplify diagnose --send-report and provide us the Project Identifier output on the terminal.
Additionally, could you add the --debug to the init command and provide us the output.

@ykethan ykethan added pending-response Issue is pending response from the issue author multienv Issues tied to multiple environment feature in the CLI labels Nov 3, 2023
@dan-hook
Copy link
Author

dan-hook commented Nov 3, 2023

Project Identifier: 04f83178cd073fa44470b41eeda4bb12

Running init with --debug prints out:
⠧ Initializing your environment: qaOverrides functionality is not implemented for this category
Overrides functionality is not implemented for this category
Overrides functionality is not implemented for this category
Overrides functionality is not implemented for this category
Overrides functionality is not implemented for this category
Overrides functionality is not implemented for this category
Overrides functionality is not implemented for this category
Overrides functionality is not implemented for this category
Overrides functionality is not implemented for this category
Overrides functionality is not implemented for this category
Overrides functionality is not implemented for this category
Overrides functionality is not implemented for this category
Overrides functionality is not implemented for this category
Overrides functionality is not implemented for this category

I ran amplify push -y --debug and got an additional line:
Deployment state saved successfully.

GraphQL transformer version: 2

Not pulling components because this project is not Amplify Studio enabled.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Nov 3, 2023
@ykethan
Copy link
Member

ykethan commented Nov 6, 2023

Hey @dan-hook, Do you also observe the error message Could not read cloudformation template at path: /workspaces/gene-panel-api/project/amplify/backend/api/genepanelapi/build/cloudformation-template.json
when pulling the backend env in a fresh directory amplify pull --appId <app-id> --envName qa?

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Nov 6, 2023
@dan-hook
Copy link
Author

dan-hook commented Nov 6, 2023

No, the current-cloud-backend has those cloudformation-template.json, so when I pull it shows up:
../backend/api/genepanelapi/build (qa)(dev ✗) $ tree -L 1
.
├── cloudformation-template.json
├── functions
├── parameters.json
├── resolvers
├── schema.graphql
└── stacks

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Nov 6, 2023
@ykethan
Copy link
Member

ykethan commented Nov 7, 2023

@dan-hook, as a quick check, could you remove the build folder from the backend/api/genepanelapi/, then run amplify build. Then try doing a push with a empty change.

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Nov 7, 2023
@dan-hook
Copy link
Author

dan-hook commented Nov 7, 2023

amplify build appeared to do nothing. The empty push behaved the same as in the bug description, Displaying
Could not read cloudformation template at path: /workspaces/gene-panel-api/project/amplify/backend/api/genepanelapi/build/cloudformation-template.json and not building schema.graphql.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Nov 7, 2023
@ykethan
Copy link
Member

ykethan commented Nov 8, 2023

Hey @dan-hook, tried reproducing the issue but did not observe this error message
Does the GraphQL API use split schema/multiple GraphQL files?
Does the application have Amplify Studio enabled? if yes, could you disable Amplify studio on the AWS console and retry the pull.

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Nov 8, 2023
@dan-hook
Copy link
Author

dan-hook commented Nov 8, 2023

@ykethan Thanks for the effort you've put in. I don't think we're going to resolve this, so I'll close this issue and work around it.

@dan-hook dan-hook closed this as completed Nov 8, 2023
@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Nov 8, 2023
Copy link

github-actions bot commented Nov 8, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@ykethan
Copy link
Member

ykethan commented Nov 9, 2023

@dan-hook would you be open for a call? want to make sure i document this behavior.
I am available on discord, my handle is ykethan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multienv Issues tied to multiple environment feature in the CLI pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

2 participants