Amplify API key not found

Mar 23, 2022 1 min read
Amplify API key not found

When this happens?

When you push to an existing environment to update the api, you get an error saying "API key not found"

Why?

Because your API key has expired. Did you forget to set the expiration to unlimited or renew it?

How to Fix it

These manual steps can help to recover into a stable state from CFN point of view, from that point APIKeyExpirationEpoch can be used as documented.

The steps:
There is a solution to recover from this by doing a change set deployment on the nested stack of the API.

Here are the steps:

  • Go to CloudFormation Console and turn on nested stacks (keep in mind this link is for region us-east-1 so select yours if different)
  • Disable View nested and select your main stack
  • Go to resources Β and tap on the resource with the same name which failed to update due to the removed API key
  • Click on the Update button
  • Select the "Update nested stack" option and click "Update stack"
  • Select the "Use current template" option and click next
  • Set APIKeyExpirationEpoch to -1
  • Set CreateAPIKey to 0
  • Click "Next"
  • Click "Next" on the "Configure stack options screen"
  • Check the acknowledgement checkbox(es) in the Capabilities section

After the Changes are calculated you should see a "Remove" action for the "GraphQLAPIKey", if that's the case, proceed.

  • Click "Update stack"

The API now should be in an updatable state.

Sources: 1

Great! Next, complete checkout for full access to ArturoFM.
Welcome back! You've successfully signed in.
You've successfully subscribed to ArturoFM.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.