Environment
- bb-browser: v0.8.0
- Chrome: 145 (macOS)
- OS: macOS (Apple Silicon)
- Network: Clash TUN mode (system-wide proxy)
- Mode: Standalone (Chrome extension + daemon)
Bug Description
Site adapters consistently fail with TypeError: Failed to fetch, but running the exact same fetch() call via bb-browser eval works perfectly. This suggests a difference in the execution context between site adapters and eval.
Steps to Reproduce
- Install bb-browser, load Chrome extension, run
bb-browser site update
- Verify extension is connected:
bb-browser status → "浏览器运行中"
- Run any site adapter:
$ bb-browser site hackernews/top 3
[error] site hackernews/top: Uncaught (in promise) TypeError: Failed to fetch
Hint: Open https://news.ycombinator.com in your browser, make sure you are logged in, then retry.
- Run the exact same fetch via eval — works fine:
$ bb-browser eval "fetch('https://hacker-news.firebaseio.com/v0/topstories.json').then(r=>r.json()).then(ids=>ids.slice(0,3))"
[47392084, 47390817, 47390945]
Additional observations
- The first
site hackernews/top call after installing the extension succeeded and returned valid JSON data
- All subsequent calls fail with the same error
- Tested multiple adapters (
hackernews/top, baidu/search, zhihu/hot) — all fail identically
bb-browser eval "fetch('https://httpbin.org/get').then(r=>r.json())" also works fine
- Switching to the target tab first (
bb-browser tab 3) does not help
- Restarting the daemon does not help
- Tab listing works, browser status reports connected
Expected behavior
Site adapters should execute fetch() in the same page context as eval, and return data successfully.
Suspected cause
Site adapter code appears to run in a different execution context (extension Service Worker? isolated world?) compared to eval, where fetch() fails — possibly due to CORS, CSP, or Chrome MV3 Service Worker restrictions.
Environment
Bug Description
Site adapters consistently fail with
TypeError: Failed to fetch, but running the exact samefetch()call viabb-browser evalworks perfectly. This suggests a difference in the execution context between site adapters andeval.Steps to Reproduce
bb-browser site updatebb-browser status→ "浏览器运行中"Additional observations
site hackernews/topcall after installing the extension succeeded and returned valid JSON datahackernews/top,baidu/search,zhihu/hot) — all fail identicallybb-browser eval "fetch('https://httpbin.org/get').then(r=>r.json())"also works finebb-browser tab 3) does not helpExpected behavior
Site adapters should execute
fetch()in the same page context aseval, and return data successfully.Suspected cause
Site adapter code appears to run in a different execution context (extension Service Worker? isolated world?) compared to
eval, wherefetch()fails — possibly due to CORS, CSP, or Chrome MV3 Service Worker restrictions.