Trying to connect to a Fuel local node via the TypeScript SDK, and running into this error: ReferenceError: fetch is not defined
.
import { FUEL_NETWORK_URL, Provider } from "fuels"
const localProvider = await Provider.create(FUEL_NETWORK_URL)
// This fails as well too
// const provider = await Provider.create("https://beta-5.fuel.network/graphql")
I’m running an in-memory node too, but I doubt that’s the issue.
Here’s the stacktrace:
ReferenceError: fetch is not defined
at /Users/sluzhba/Documents/Dev/Burra Labs/ruscet-contracts/node_modules/@fuel-ts/providers/src/provider.ts:310:7
at fetch (node_modules/@fuel-ts/providers/src/provider.ts:438:9)
at /Users/sluzhba/Documents/Dev/Burra Labs/ruscet-contracts/node_modules/graphql-request/src/index.ts:177:16
at step (node_modules/graphql-request/dist/index.js:63:23)
at Object.next (node_modules/graphql-request/dist/index.js:44:53)
at /Users/sluzhba/Documents/Dev/Burra Labs/ruscet-contracts/node_modules/graphql-request/dist/index.js:38:71
at new Promise (<anonymous>)
at __awaiter (node_modules/graphql-request/dist/index.js:34:12)
at post (node_modules/graphql-request/dist/index.js:160:12)
at /Users/sluzhba/Documents/Dev/Burra Labs/ruscet-contracts/node_modules/graphql-request/src/index.ts:466:26
It appears that the source of the error is here (but I could be wrong).
I’m using the current v0.73.0
of the SDK.