Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a table reference in custom handler causes sandbox deployment to fail #2770

Closed
ngmeyer opened this issue Aug 12, 2024 · 3 comments
Closed
Assignees
Labels
bug Something isn't working duplicate This issue or pull request already exists Gen 2 transferred

Comments

@ngmeyer
Copy link

ngmeyer commented Aug 12, 2024

Environment information

System:
  OS: macOS 14.5
  CPU: (8) arm64 Apple M1 Pro
  Memory: 112.25 MB / 16.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 18.17.0 - /usr/local/bin/node
  Yarn: 1.22.19 - /opt/homebrew/bin/yarn
  npm: 10.8.1 - /opt/homebrew/bin/npm
  pnpm: 8.15.1 - /opt/homebrew/bin/pnpm
NPM Packages:
  @aws-amplify/auth-construct: 1.2.0
  @aws-amplify/backend: 1.0.4
  @aws-amplify/backend-auth: 1.1.1
  @aws-amplify/backend-cli: 1.2.2
  @aws-amplify/backend-data: 1.1.0
  @aws-amplify/backend-deployer: 1.0.3
  @aws-amplify/backend-function: 1.3.0
  @aws-amplify/backend-output-schemas: 1.1.0
  @aws-amplify/backend-output-storage: 1.0.2
  @aws-amplify/backend-secret: 1.0.0
  @aws-amplify/backend-storage: 1.0.4
  @aws-amplify/cli-core: 1.1.1
  @aws-amplify/client-config: 1.1.2
  @aws-amplify/deployed-backend-client: 1.2.0
  @aws-amplify/form-generator: 1.0.0
  @aws-amplify/model-generator: 1.0.3
  @aws-amplify/platform-core: 1.0.4
  @aws-amplify/plugin-types: 1.1.0
  @aws-amplify/sandbox: 1.1.1
  @aws-amplify/schema-generator: 1.2.0
  aws-amplify: 6.5.0
  aws-cdk: 2.151.0
  aws-cdk-lib: 2.151.0
  typescript: 5.5.4
AWS environment variables:
  AWS_PROFILE = xyz
  AWS_DEFAULT_REGION = us-east-1
  AWS_REGION = us-east-1
  AWS_STS_REGIONAL_ENDPOINTS = regional
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables

Description

During development of a custom handler sandbox development will receive to following error:

The CloudFormation deployment has failed.
Caused By: ❌ Deployment failed: MissingRequiredParameter: Missing required key 'functionId' in params


Resolution: Find more information in the CloudFormation AWS Console for this stack.

This is caused by the usage of a non-hotswapable resource. Extending the general example provided in the documentation

const schema = a.schema({
  Echo: a.model({
    content: a.string(),
    executionDuration: a.float()
  }),

  echo: a
    .query()
    .arguments({ content: a.string() })
    .returns(a.ref('Echo'))
    .authorization(allow => [allow.publicApiKey()])
    .handler(a.handler.custom({
      dataSource: a.ref('Echo'),
        entry: './echo-handler.js'
      });

In this example the dataSource of the Echo Table is not hotswapable, so sandbox deployments while this is set.
Workaround whenever modifying this code.

  1. Comment out the dataSource
  2. Save the file so the sandbox deployment proceeds.
  3. Restore the dataSource - sandbox deployment proceeds with the datasource set properly in appSync.
@ykethan
Copy link
Member

ykethan commented Aug 13, 2024

Hey👋 thanks for raising this! The issue appears to be similar to #2307. I'm going to transfer this over to our API repository for better assistance 🙂

@ykethan ykethan transferred this issue from aws-amplify/amplify-backend Aug 13, 2024
@AnilMaktala AnilMaktala added the duplicate This issue or pull request already exists label Aug 14, 2024
@david-mcafee david-mcafee self-assigned this Aug 16, 2024
@AnilMaktala AnilMaktala added the bug Something isn't working label Aug 30, 2024
@AnilMaktala
Copy link
Member

Hey @ngmeyer, This issue has been resolved in https://github.com/aws/aws-cdk/releases/tag/v2.159.0 version. Please upgrade your lib to v2.159 version and let us know the results.

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists Gen 2 transferred
Projects
None yet
Development

No branches or pull requests

5 participants