Skip to content

Documentation not clear on passing Secrets Store secrets into container #96

@brianhardeman

Description

@brianhardeman

The examples for passing secrets store secrets into containers do not work. The syntax in both of these variations does not seem to be correct:
https://developers.cloudflare.com/containers/examples/env-vars-and-secrets/#using-envvars-on-the-container-class
https://developers.cloudflare.com/containers/examples/env-vars-and-secrets/#setting-environment-variables-per-instance

In both cases, env.SECRET_STORE.ACCOUNT_API_KEY does not appear to be the correct way to access the secret shown in the binding as

  "secrets_store_secrets": [
    {
      "binding": "SECRET_STORE",
      "store_id": "demo",
      "secret_name": "ACCOUNT_API_KEY"
    }

I believe the correct way to retrieve the secret is with env.SECRET_STORE.get() for the strange naming used in this example. This will work for the per-instance example, as the get() call is inside the asynchronous worker fetch, but it will not work in the Container class envVars example since get() does not work in that context.

Is there a recommended way to get secret store secrets into the container without having to set them per-instance and manually start?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions