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:
- remove the layer directory from
amplify/backend/function
- remove the layer references in
amplify/team-provider-info.json
- remove the layer references in
amplify/backend/backend-config.json
- run
amplify env checkout <current-env-name>
- this should now show your layer in the
DELETE
state - push with
amplify push -y
- observe successful removal from project 🙌