anthropics / anthropics/claude-code-action

v1.0.79: SDK crashes with dangerouslyAllowBrowser error on self-hosted runners

Open
#1,126 4 comments 3 reactions 0 assignees View on GitHub
area:installation bug p1
Dominant language
TypeScript
Stars
8.9k
Forks
2.1k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

## Description

After updating from v1.0.72 to v1.0.79, the Claude Code Action crashes immediately during initialization with the Anthropic SDK's `dangerouslyAllowBrowser` error. This happens on **all** self-hosted runners (tested on 3 separate runners). Rolling back to v1.0.72 (SDK 0.2.76) resolves the issue.

## Error

```
SDK execution error: 53 | you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
54 |
55 | new Anthropic({ apiKey, dangerouslyAllowBrowser: true });

error: Claude Code process exited with code 1
```

## Environment

- **Self-hosted runners** on Ubuntu 24.04 (x64)
- **Bun 1.3.6** (installed via `oven-sh/setup-bun`)
- **Node 22** (installed via `actions/setup-node`)
- **Runner version:** 2.333.0
- **Auth method:** OAuth token (`claude_code_oauth_token`)

## Reproduction

1. Pin to v1.0.79 SHA `3ac52d0da9f8ec9ca7b4dc23bb477e36ef9c77a9`
2. Trigger via `@claude` comment on an issue
3. Action crashes during SDK initialization, before any Claude work begins

## Working vs Broken

| Version | SDK | Result |
|---------|-----|--------|
| v1.0.72 (cd77b50) | 0.2.76 | Works — successful audit runs daily |
| v1.0.79 (3ac52d0) | 0.2.84 | Crashes — dangerouslyAllowBrowser |

## Root Cause Hypothesis

The Anthropic JS SDK's browser environment detection was tightened in a version between 0.2.76 and 0.2.84. Since the action's entrypoint runs via `bun run`, and Bun exposes browser-like globals (e.g., `window`, `navigator`), the SDK incorrectly identifies the runtime as a browser and refuses to run.

## Workaround

Pinned to v1.0.72 (`cd77b50d2b0808657f8e6774085c8bf54484351c`). This blocks us from receiving security and feature updates.

Contributor guide

Open the contributing guide

Research direction

Start at the Claude Code Action entrypoint invoked with `bun run` and its Anthropic SDK initialization. Compare the dependency and runtime behavior between v1.0.72 and v1.0.79, using the supplied self-hosted Ubuntu reproduction and SDK versions. Done means the action initializes successfully on self-hosted runners without weakening the SDK's browser-safety check.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, github-actions, typescript
Domain
ci-cd, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.