Skip to content

Hardcoded ENV Names #669

@mujtabashamas

Description

@mujtabashamas

Bug: Environment Variable Name Inconsistency

File:
packages/sdk-server/src/actions.ts

Description

The SDK currently hardcodes environment variable names for Turnkey credentials directly in the code, for example:

Code in file mentioned

const turnkeyClient = new TurnkeyServerSDK({
  apiBaseUrl: process.env.NEXT_PUBLIC_BASE_URL!,
  defaultOrganizationId: process.env.NEXT_PUBLIC_ORGANIZATION_ID!,
  apiPrivateKey: process.env.TURNKEY_API_PRIVATE_KEY!,
  apiPublicKey: process.env.TURNKEY_API_PUBLIC_KEY!,
});

Example that works in other setups:

const turnkey = new Turnkey({
  defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID,
  apiBaseUrl: "https://api.turnkey.com",
  apiPublicKey: process.env.TURNKEY_PUBLIC_API_KEY,
  apiPrivateKey: process.env.TURNKEY_PRIVATE_API_KEY,
});

Notice the difference:

  • TURNKEY_API_PUBLIC_KEY vs TURNKEY_PUBLIC_API_KEY
  • TURNKEY_API_PRIVATE_KEY vs TURNKEY_PRIVATE_API_KEY

Steps to Reproduce

  1. Set env vars to TURNKEY_PUBLIC_API_KEY and TURNKEY_PRIVATE_API_KEY
  2. Use SDK as in the repo (TURNKEY_API_PUBLIC_KEY, TURNKEY_API_PRIVATE_KEY)
  3. Keys will be undefined and authentication will fail

Expected Behavior

The SDK and all documentation/examples should use consistent environment variable names.

Actual Behavior

The env var names differ, leading to misconfiguration and runtime errors.

Screenshot

Screenshot showing config

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