Skip to main content
Alchemy has no separate secrets service. Secrets are created and referenced through the function RPCs: secret_values on CreateFunction and CreateFunctionVersion creates them, and spec.secrets names them. No RPC lists, reads, rotates or deletes a secret, and no RPC returns a value. See Secrets for how values reach a function.

Fields

secret_values

For each entry the server writes a secret named <function_id>.<suffix>.<VARIABLE>, where the suffix is 8 random hex characters shared by the version’s values, and adds VARIABLE to the stored spec.secrets under that name. Every version gets secrets of its own, so a new version never changes what an older one reads. A variable named in both spec.secrets and secret_values takes the new secret.
The returned version’s spec.secrets then reads {"API_TOKEN": "<function-id>.1a2b3c4d.API_TOKEN"}. After writing, the server tells every host to drop its cached values for those names.

spec.secrets

Each key must be an environment variable name (^[A-Za-z_][A-Za-z0-9_]*$). Each value must be a secret name (^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$) that an earlier secret_values created for the same function, such as when a version’s own spec is sent back as a new version. A function cannot name another function’s secret, and CreateFunction takes secrets only through secret_values. Values are never stored with the version. The host fetches them from the server when it runs an invocation, and gets only the names the version it runs lists in spec.secrets.

Provider

The server stores secrets in the provider SECRET_PROVIDER selects, under the ref alchemy/<tenant>/<name>. With the datastore provider and no ENCRYPTION_KEY, the server starts with no secret provider and logs a warning.
The existence check on spec.secrets reads the secrets table in PostgreSQL, which only the datastore provider writes. With aws-secrets-manager or gcp-secret-manager, secret_values works but a spec that names an existing secret is not_found.
See Configuration.

Errors