amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

Lambda layers with graphql API does not update

Open frankclaassen opened this issue 6 years ago • 5 comments

Note: If your issue/bug is regarding the AWS Amplify Console service, please log it in the Amplify Console GitHub Issue Tracker

Describe the bug Followed the instructions at https://docs.amplify.aws/guides/functions/appsync-operations-to-lambda-layer/q/platform/js#set-up-your-layer to the letter to implement my graphql API as a layer for lambda functions but when I made changes to my schema, the updated queries / mutations were not available in the layer

Amplify CLI Version 4.34.0

To Reproduce

  • Follow https://docs.amplify.aws/guides/functions/appsync-operations-to-lambda-layer/q/platform/js#set-up-your-layer and add appsyncOperation function layer
  • Add a function and configure it to use the layer
  • amplify push
  • make changes to schema and add a @key with queryField to a table
  • amplify push
  • run update script to update queries / mutations on layer
  • amplify push
  • update function code to use new query which was added and configure function to use new layer version
  • amplify push
  • test code and you get an error that the new query is undefined

Expected behavior

  • expect function layer to have new queries / mutations available

Additional context I use multiple environments

frankclaassen avatar Nov 25 '20 23:11 frankclaassen

@frankclaassen Are you using the latest version of your layer before you push?

ammarkarachi avatar Nov 26 '20 01:11 ammarkarachi

@ammarkarachi yup, as stated in my description: update function code to use new query which was added and configure function to use new layer version

frankclaassen avatar Nov 26 '20 02:11 frankclaassen

Any feedback? I'm starting to rack up a number of functions and due to this issue, I have to update each function with GQL queries / mutations and I would much rather make use of the layers to keep my functions slimline

frankclaassen avatar Feb 24 '21 00:02 frankclaassen

Hi @frankclaassen,

We have an alpha build of our redesign of Lambda layers in Amplify CLI available to try. This includes several bug fixes and new features. It also includes a one-way migration step for existing layer resources. Lambda layer resources pushed with this build will not work with any other version of the Amplify CLI.

DO NOT USE THIS IN PRODUCTION!

To test it out: npm i -g @aws-amplify/cli@not-for-production-layers

Notable changes:

  • Complete redesign of layer version tracking. New code does not make assumptions about what layer versions exist in the cloud and always pulls the latest data from the Lambda service
  • Option to automatically update dependent functions to the latest deployed Lambda layer version
  • Added ability to delete individual layer versions
  • Layers now have a dependency installation step that will install dependencies based on what's in package.json for NodeJS or Pipfile for Python
  • Support editing layer version descriptions
  • Removes local version state tracking from amplify-meta.json and team-provider-info.json

We'd love to hear any community feedback!

jhockett avatar May 25 '21 17:05 jhockett

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

github-actions[bot] avatar Sep 12 '21 01:09 github-actions[bot]