-
Notifications
You must be signed in to change notification settings - Fork 78
import objects from "@permaweb/aoconnect" get error in a Next.js project when using NextJS App Router #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @iamgamelover , sorry you're having issues. Both of these issues are downstream from NextJS' config. The first issue is most likely due to NextJS webpack config -- import * as WarpArBundles from "warp-arbundles";
var { createData, ArweaveSigner } = WarpArBundles; I suspect something with NextJS webpack config is trying to support the myriad of ESM+CJS combinations that exist in NodeJS ecosystem, and is getting tongue tied. Sounds like the The seconds issue is an error in NextJS' static code analysis (also being done by Webpack, it seems). It's claiming that read-only property But this is definitely valid using static members. Maybe there's a way to suppress the static check with NextJS? |
fixed by changes in #527 . Closing. |
Thank you, Sir! |
@iamgamelover we determined that an issue only occurs when using NextJS' "App Router". So another workaround is to not use App Router and instead use conventional API routes. That worked with the latest version of NextJS. We'll need to investigate the deal with App Router, but that seems to be the source of the issue. |
Reopening. The original issue was solved, but it unveiled another issue when using NextJS' App Router. |
next.js version |
But I can help investigate the issue with next.js 14 and see if there are workarounds without downgrading |
Hey @Merdi-kim @TillaTheHun0 has any progress been made on this? Happy to help if I can, would love to not have to downgrade or go back to the pages api 😄 I was digging through the AO discord and there was some talk about this PR warp-contracts/warp#514 potentially helping things? Haven't been able to find how it relates to this exactly though... |
@TillaTheHun0 afaik, no progress has been made on this. It's definitely something to do with NextJS App Router, as using NextJS "conventional" api routes works, even on latest versions of NextJS. Re: PR to warp: |
As far as I can tell, this is an issue with Webpack which is what Next.js uses under the hood. There is an open issue with little traction on the Next.js repo here vercel/next.js#49120 And there are some other discussions that are giving some extra context vercel/next.js#32714 One fix is to simply append
However, you can edit the next.config.mjs file to "rewrite" the package to point to browser so you don't have to edit this each time, and so that auto import can keep working as normal...
|
Hello everyone,
I used
import { createDataItemSigner, message, dryrun } from "@permaweb/aoconnect";
in a Next.js project.Running on localhost, get an error on the browser page.
I changed to
const { createDataItemSigner, message, dryrun } = require("@permaweb/aoconnect");
and it's working.But when I'm deploying it to vercel.com, get a new error on the vercel deploy page:
Anybody can give me some advices? Thanks.
The text was updated successfully, but these errors were encountered: