Skip to content

nebo.fetch: Nebo's own refusal reaches the page as fetch() gives it - #14

Merged
localrivet merged 1 commit into
mainfrom
fetch-proxy-errors
Oct 23, 2026
Merged

localrivet merged 1 commit into
mainfrom
fetch-proxy-errors

Conversation

@localrivet

Copy link
Copy Markdown
Contributor

On top of #11.

The problem

nebo.fetch('https://…') goes through the app's http/proxy. When Nebo itself refuses the call it answers in plain text: 403 app lacks permission: network:<host> (no grant, or the owner said no) or 502 proxy error: … resolves to a local or private network address. neboFetch called resp.json() on every answer, so the page got SyntaxError: … is not valid JSON instead of the refusal (found in the review of nebo #1001, whose App Studio skill tells builders what these refusals look like).

The change

  • A non-2xx answer from the proxy itself is returned to the page as it is, the way fetch() gives any answer: its status and its words.
  • A 2xx proxy answer is unwrapped as before (the site's own status, headers and body).

Tests

test/fetch.test.mjs: a 403 refusal reaches the page with its status and text; a site's own 404 still comes back as the site gave it. pnpm build && pnpm test: 9/9 (it fails on the old dist with the JSON error).

Note: nebo's bundled app/static/sdk/nebo.global.js is rebuilt from the SDK by the nebo PR that lands last in the app-platform train (#1018 / #1020); rebuild it after this merges.

🤖 Generated with Claude Code

When the app's http/proxy refuses the call (403 naming the permission the
app lacks, 502 for an address Nebo never reaches), that answer is returned
as it is, status and words, instead of being parsed as the proxy's JSON
envelope (which threw "... is not valid JSON").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@localrivet
localrivet changed the base branch from app-files-read to main October 23, 2026 15:16
@localrivet localrivet closed this Oct 23, 2026
@localrivet localrivet reopened this Oct 23, 2026
@localrivet
localrivet merged commit 516171f into main Oct 23, 2026
2 checks passed
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