Skip to content

fix: derive OSC_ENV from OSC_MCP_URL for config-to-env and token refresh#8

Merged
birme merged 1 commit intomainfrom
fix/config-to-env-env-detection
May 9, 2026
Merged

fix: derive OSC_ENV from OSC_MCP_URL for config-to-env and token refresh#8
birme merged 1 commit intomainfrom
fix/config-to-env-env-detection

Conversation

@birme
Copy link
Copy Markdown
Owner

@birme birme commented May 9, 2026

Problem

scripts/entrypoint.sh called the OSC CLI config-to-env command without an --env flag, so it always targeted the prod environment. On dev/stage, getServiceAccessToken then called the prod token service with a dev/stage JWT (signed with a dev/stage key). The prod token service correctly rejected it: "Authorization token is invalid: The token signature is invalid."

The token refresh curl call already used ${OSC_ENV:-prod}, but OSC_ENV was never set, so it also silently hit prod.

Fix

OSC_MCP_URL is always injected into the runner job and its hostname encodes the environment:

  • https://ai.svc.dev.osaas.io/mcpdev
  • https://ai.svc.stage.osaas.io/mcpstage
  • https://mcp.osaas.io/mcpprod

An env-detection block extracts the environment from OSC_MCP_URL using sed and sets OSC_ENV before the token refresh and config-to-env calls. The config-to-env invocation now passes --env "${OSC_ENV:-prod}".

This is the same fix applied to birme/claude-runner via PR #14.

Changes

  • scripts/entrypoint.sh: add env-detection block; add --env flag to config-to-env call

Part of Eyevinn/osaas-app#3762

🤖 Generated with Claude Code

Without --env, the CLI defaulted to prod, causing the prod token service
to reject dev/stage JWTs with "token signature is invalid". Extract the
environment from OSC_MCP_URL (always injected by the runner job) and pass
it via --env to the config-to-env call. The token refresh URL already uses
${OSC_ENV:-prod} so it picks up the derivation automatically.

Part of Eyevinn/osaas-app#3762

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant