Skip to content

secrets that do not exist do not error when used with Functions #2075

Open
@josefaidt

Description

@josefaidt

Environment information

System:
  OS: macOS 14.6.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 168.42 MB / 32.00 GB
  Shell: /opt/homebrew/bin/fish
Binaries:
  Node: 22.8.0 - ~/.local/state/fnm_multishells/13750_1727708399158/bin/node
  Yarn: undefined - undefined
  npm: 10.8.2 - ~/.local/state/fnm_multishells/13750_1727708399158/bin/npm
  pnpm: 9.10.0 - ~/.local/state/fnm_multishells/13750_1727708399158/bin/pnpm
NPM Packages:
  @aws-amplify/auth-construct: Not Found
  @aws-amplify/backend: 1.3.0
  @aws-amplify/backend-auth: Not Found
  @aws-amplify/backend-cli: 1.2.8
  @aws-amplify/backend-data: Not Found
  @aws-amplify/backend-deployer: Not Found
  @aws-amplify/backend-function: Not Found
  @aws-amplify/backend-output-schemas: Not Found
  @aws-amplify/backend-output-storage: Not Found
  @aws-amplify/backend-secret: Not Found
  @aws-amplify/backend-storage: Not Found
  @aws-amplify/cli-core: Not Found
  @aws-amplify/client-config: Not Found
  @aws-amplify/deployed-backend-client: Not Found
  @aws-amplify/form-generator: Not Found
  @aws-amplify/model-generator: Not Found
  @aws-amplify/platform-core: Not Found
  @aws-amplify/plugin-types: Not Found
  @aws-amplify/sandbox: Not Found
  @aws-amplify/schema-generator: Not Found
  aws-amplify: 6.6.2
  aws-cdk: 2.160.0
  aws-cdk-lib: 2.160.0
  typescript: 5.6.2
AWS environment variables:
  AWS_PROFILE = josef
  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

Describe the feature

When using a secret on a Function that does not exist I am not presented with an error notifying me of the missing secret like I do for Auth. This can be confusing because I will not see an error until the Function is invoked and fails to resolve the secret.

// amplify/functions/say-hello/resource.ts
import { defineFunction, secret } from "@aws-amplify/backend"

export const sayHello = defineFunction({
  name: "say-hello",
  environment: {
  	MY_SECRET: secret("DOES_NOT_EXIST"),
  },
})

Use case

see above

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestNew feature or requestfunctionIssue pertaining to Amplify Function

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions