Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinold/939b081bf67383a39de1e160813fa0f4 to your computer and use it in GitHub Desktop.
Save kevinold/939b081bf67383a39de1e160813fa0f4 to your computer and use it in GitHub Desktop.
Instructions for surgically removing non-existent resource from local Amplify project

Let's say we've removed a Lambda Layer from the Lambda Console and are no longer able to perform operations using the Amplify CLI.

An error occurred fetching the latest layer version metadata for ""

> amplify remove function
? Choose the resource you would want to remove 10263layer58c94806 (layer)
When you delete a layer version, you can no longer configure functions to use it.
However, any function that already uses the layer version continues to have access to it.
✖ Loading layer data from the cloud...
An error occurred fetching the latest layer version metadata for "10263layer58c94806": Cannot read property 'LogicalName' of undefined

But no worries! We can do a few manual edits to remove this layer from our local project:

  1. remove the layer directory from amplify/backend/function
  2. remove the layer references in amplify/team-provider-info.json
  3. remove the layer references in amplify/backend/backend-config.json
  4. run amplify env checkout <current-env-name>
  5. this should now show your layer in the DELETE state
  6. push with amplify push -y
  7. observe successful removal from project 🙌
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment