Skip to content

fix: fetch polyfill - #18

Merged
Prasanna-ramesh merged 2 commits into
mainfrom
fix/fecth-polyfill
Nov 6, 2026
Merged

Prasanna-ramesh merged 2 commits into
mainfrom
fix/fecth-polyfill

Conversation

@Prasanna-ramesh

@Prasanna-ramesh Prasanna-ramesh commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Why

Host-side allowedHost is completely blocked to support a per-request egress policy. When testing, the GO SDK blocked the request from reaching the egress. So, a custom fetch host function is used instead of allowing the domains on the host.

Summary by CodeRabbit

  • New Features
    • Connector scripts can now make web requests through the host-provided fetch capability, with response status and content available to the script.
  • Configuration
    • The AWS Docker Compose setup now exposes Stackport on host port 8000 instead of 8080.

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The SDK adds a Host fetch capability and routes polyfill requests through it. The mock host proxies these requests and returns response data or an error. The AWS Compose configuration maps host port 8000 to container port 8080.

Changes: SDK Host Fetch

Layer / File(s) Summary
Host fetch contract and polyfill
packages/connector-sdk/extism-jspdk.d.ts, packages/connector-sdk/lib/bun-plugin/codegen.plugin.ts, packages/connector-sdk/lib/polyfills/fetch.ts, packages/connector-sdk/lib/runtime-env.d.ts
The host declarations add fetch(offset: I64): I64. The polyfill serializes requests for the Host capability, handles its response, and frees allocated memory. It installs the polyfill even when a global fetch exists.
Mock host fetch proxy
packages/connector-sdk/lib/test/mock-host.ts
The mock host reads the JSON request from guest memory and proxies it. It stores response status and text, or returns a stored 403 error response when proxying fails.

AWS Compose Port

Layer / File(s) Summary
Stackport host mapping
connectors/aws/docker-compose.yml
The stackport host port changes from 8080 to 8000. The container port remains 8080.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant QuickJS as QuickJS Fetch polyfill
  participant Host as Extism Host fetch import
  participant MockHost as Mock host proxy
  QuickJS->>Host: Send JSON request through guest memory
  Host->>MockHost: Read request and proxy URL, method, headers, and body
  MockHost-->>Host: Store response status and text as JSON
  Host-->>QuickJS: Return response offset
Loading
Merge Risk: Moderate · up to 8b668

Preserve native fetch outside the guest runtime, document Stackport’s new port, and add a changeset before merging. Host-side requests can otherwise fail, existing local clients lose connectivity, and the changeset check remains blocked.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Prasanna-ramesh
Prasanna-ramesh merged commit 63b07ee into main Nov 6, 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