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

Codegen add with apiId breaking when initialising new dev #225

Closed
SebSchwartz opened this issue Sep 24, 2019 · 11 comments
Closed

Codegen add with apiId breaking when initialising new dev #225

SebSchwartz opened this issue Sep 24, 2019 · 11 comments
Labels
amplify-codegen Issues on amplify-codegen feature-request New feature or request

Comments

@SebSchwartz
Copy link

Describe the bug
When adding codegen to a project (appsync not created with amplify) with apiId option. If a new developper enter the project and init amplify selecting an existing env, amplify status will tells him that pushed changes will delete it.

To Reproduce
Steps to reproduce the behavior:

  1. Create an amplify project and add codegen: amplify add codegen --apiId AppSyncAPIid
  2. Push changes and push in git also (.graphqlconfig.yml is also in git repo)
  3. Checkout project on another dev computer
  4. Execute amplify init to select right role,...
  5. amplify status will show:
    | Category | Resource name | Operation | Provider plugin |
    | -------- | ----------------------- | --------- | ----------------- |
    | Auth | xxx | No Change | awscloudformation |
    | Hosting | xx | No Change | awscloudformation |
    | Api | xxx | Delete | |
    | Function | xx | No Change | awscloudformation |

Only way to get normal status again is to remove api and add it again.

Expected behavior
All category should be in "No Change" state and the new dev should get the amplify working fine after init.

Desktop (please complete the following information):
Cli version: 1.12.0 on mac (created the project and added the api)
Cli version: 3.9.0 on windows/linux (joined project after)

Additional context
One thing that was maybe different and can help debugging: One dev was on mac and the other one was on windows so the .graphqlconfig.yml changed the / to \ . I don't know if this could be the problem or help debugging it... (problem also occurs on a linux as second dev laptop).

@nikhname nikhname self-assigned this Sep 26, 2019
@nikhname
Copy link
Contributor

Hi @SebSchwartz, could you upgrade your amplify version to 3.10.0 and see if this problem persists?

@SebSchwartz
Copy link
Author

Yes the problem is solved with the new version.

Thank you!

@jskrt
Copy link

jskrt commented Oct 4, 2019

I'm running into this issue right now with cli version 3.11.0. When I add the api with the apiId and do an amplify status, it shows the added api, the resource name, with the operation "No Change" so there's nothing to push. If I switch the master branch and the master env, I see that the API operation changes to "Delete.

@jskrt
Copy link

jskrt commented Oct 4, 2019

Just tried again and instead of "Delete" in the master env, it's showing "Create" but even after pushing, it doesn't change the operation or even add the GraphQL endpoint and other info to aws-exports.json

@kaustavghosh06
Copy link
Contributor

@jskrt Currently when you add an API externally i.e when you don't create it using the CLI, it's not multi-environment agnostic. If you want multi-environment support, I would recommend adding the API via the CLI. We'll dig deep and look into make the external addition/import of API multi-environment friendly as well.

@SebSchwartz SebSchwartz reopened this Jan 7, 2020
@SebSchwartz
Copy link
Author

@kaustavghosh06
The issue is now present again with new version 4.11.0...
I could do a workaround manually with amplify codegen remove then amplify codegen add --apiId xxx BUT I got this problem inside a CICD so I cannot walkthrough the steps to add the API... And it doesn't seem to have an headless version of codegen add from what I saw from the sources.

@nikhname
Copy link
Contributor

@SebSchwartz What is in the .gitignore for your project?

@SebSchwartz
Copy link
Author

@nikhname .gitignore:

# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# build artifacts
src/**/*.css

#amplify
amplify/\#current-cloud-backend
amplify/.config/local-*
amplify/backend/amplify-meta.json
amplify/backend/awscloudformation
build/
dist/
node_modules/
aws-exports.js
awsconfiguration.json

@stale
Copy link

stale bot commented May 9, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@nikhname
Copy link
Contributor

Marking this as an enhancement as adding an api externally is not currently multi-environment agnostic

@nikhname nikhname removed their assignment Dec 15, 2020
@edwardfoyle edwardfoyle transferred this issue from aws-amplify/amplify-cli Aug 16, 2021
@phani-srikar phani-srikar added feature-request New feature or request amplify-codegen Issues on amplify-codegen labels Mar 29, 2022
@dpilch dpilch closed this as completed Apr 4, 2024
Copy link

github-actions bot commented Apr 4, 2024

This issue is now closed. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
amplify-codegen Issues on amplify-codegen feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants