ArweaveTeam / arweave-js

Browser and Nodejs client for general interaction with the arweave protocol and gateways

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ar-js and web environments

LorimerJenkins opened this issue · comments

When in a next-js TS app, calling Arweave.init there is this error

Unhandled Runtime Error
TypeError: arweave__WEBPACK_IMPORTED_MODULE_5__.init is not a function

Code as follows

import Arweave from "arweave"

const arweave = Arweave.init({
            host: 'arweave.net',
            port: 443,
            protocol: 'https'
          });
const JWK_public_key = arweave.wallets.jwkToAddress(jwk)

Would this code be running on the server, browser, or both - hint, it can't run on both

Hey @rosmcmahon

This code is just running in the browser

You will have to give more information. There are many projects using arweave-js successfully with nextjs.
Here is a reference to what I'm guessing may be wrong https://flaviocopes.com/nextjs-server-client-code/

i'm closing this for now, feel free to reopen, or start a conversation in the Arweave Dev Talk support discord