Amplify-cli: REST API endpoint/name aren't added to aws-exports.js

Created on 17 Apr 2019  路  13Comments  路  Source: aws-amplify/amplify-cli

Describe the bug
Adding an API using amplify add api of type REST works but does not update aws-exports.js with the endpoint.

To Reproduce
Steps to reproduce the behavior:

  1. Make amplify app
  2. Add REST API using amplify add api
  3. Observe that endpoint and name of API are not added to aws-exports.js, despite being outputs from the CFN stack

Expected behavior
I expected the name to be definedin aws-exports.js so I don't have to hard code myself in code calling API.

pending-response question

All 13 comments

What does amplify status show for your api categories?

My apologies. I see what happened now. I added the resources and committed to the repo and let the Amplify console deploy. I did not run publish locally.

Is there a command to sync local with the cloud without executing publish?

@et304383
Current there's no such command, we are evaluating the pull command for each individual categories though, such as for GraphQL API https://github.com/aws-amplify/amplify-cli/issues/1220, you are welcome to comment on that.

I believe what @et304383 is looking for is amplify push but I may be mistaken.

@wizawuza no. I'm looking for a command to sync local with what's up in the Cloud. But I may be misunderstanding the local deployment vs the Amplify console deployment.

Which direction sync? Push what you have local to the AWS backend (e.g., DynamoDB, AppSync, etc.), or pull from all of that to your local?

Pull cloud back to local. So that local is aware of what's in the cloud that was deployed by the Amplify console.

Amplify console doesn't deploy all that backend, it's only deploying the frontend stuff. Although I don't work at AWS so maybe I'm wrong. EDIT, I am wrong =(
My workflow is as such:
EDITED as my workflow is incorrect and I do not want anyone else to make that mistake.

@wizawuza
Amplify Console does deploy the backend stuff too.

@UnleashedMind Oops, my apologies.

Then what is the recommended flow for someone that uses the CLI as well as Amplify Console (which I think is basically what @et304383 is asking).

Amplify CLI and Amplify Console are two separate offerings from the Amplify suite. Amplify Console also uses Amplify CLI to setup customer backend resources.
Amplify CLI sets up and helps you to manage the backend resources for your project, it can be used on its own.
Amplify Console provides a Git-based workflow for deploying and hosting full stack serverless web applications.

@et304383
If you just want to pull down what's set up by the Amplify Console to your local development, you can use the amplify env pull command.

I would prefer that aws-exports.js pulls out Invoke URL of API Gateway so that I don't have to manage them on separate .env file

Was this page helpful?
0 / 5 - 0 ratings