Manage a function's .env file.
Node.js only. C# functions keep configuration in appsettings.json / dotnet user-secrets, and these commands exit with an error if sinch.json declares runtime: csharp.
Create .env from your sinch.json variables and stored credentials. Use this to recover a deleted or missing .env — for example after a fresh clone, or when sinch functions deploy refuses to run because the file is gone.
sinch env init [--force]Options
| Option | Description |
|---|---|
--force | Overwrite an existing .env file. |
Without --force, the command refuses to touch an existing .env rather than overwrite work in progress.
What it writes
The scaffold contains your project identifiers (PROJECT_ID, FUNCTION_ID, PROJECT_ID_API_KEY), every variable declared in sinch.json, and an empty KEY= line for each secret.
What it cannot restore
- Secret values. These live in the OS keychain and resolve at deploy time, so they are written as empty placeholders. Add any that are missing with
sinch secrets add <KEY> <VALUE>. - Non-secret values you typed by hand. The CLI has no record of what they were — re-enter them.
To restore a deployed function completely, including its secret values, use sinch functions download <function-id> instead.
sinch functions deploy— refuses to deploy a Node.js function with no.envsinch secretscommands — store secret values in the OS keychain- Configuration and secrets — how
.env,sinch.json, and the keychain fit together