Hello,
I am building a confluence app with anthropic-ai sdk.
By default, this library uses node-fetch
in Node, and expects a global fetch
function in other environments.
When I use the library I get the error below.
Error: Error thrown in the snapshot context.
App code snapshot error: Snapshot error occurred: Error: this environment is missing the following Web Fetch API type: fetch is not defined. You may need to use polyfills
Learn more about the snapshot context at https://go.atlassian.com/forge-snapshot-context.
I have tried passing it forge’s fetch like so, but had no luck:
import { fetch } from "@forge/api";
const client = new Anthropic({
fetch
},
});
Any ideas?