cloudflare / cloudflare/containers

Documentation not clear on passing Secrets Store secrets into container

Open
#96 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
270
Forks
42
Avg merge
1d 5h
Merged PRs (30d)
4

Description

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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.