Skip to content

Function: requireCredential()

ts
function requireCredential(key, hint?): string;

Defined in: packages/core/src/credentials/credentials.ts:317

Read a credential at runtime.

On Vinkius Cloud Edge, the runtime injects secrets into globalThis.__vinkius_secrets before the first tool call.

Parameters

ParameterTypeDescription
keystringThe credential key as declared in defineCredentials().
hint?stringOptional hint shown in the error message (e.g., where to find the value).

Returns

string

Throws

when the credential is absent or empty.

Example

ts
function getRedis() {
  const url   = requireCredential('REDIS_URL', 'Found in your Upstash console.');
  const token = requireCredential('REDIS_TOKEN', 'Found in your Upstash console.');
  return new Redis({ url, token });
}