Skip to content
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

Next.js 13 App Router Issue #106

Open
skilldeliver opened this issue Mar 26, 2023 · 3 comments
Open

Next.js 13 App Router Issue #106

skilldeliver opened this issue Mar 26, 2023 · 3 comments

Comments

@skilldeliver
Copy link

Hello,
I am working on a project with Next.js 13 and it seems that there is this error when I am using useWallet in any file of the app dir.

error - node_modules/@aptos-labs/wallet-adapter-react/dist/index.js (37:2) @ DEFAULT_COUNTEXT
error - TypeError: (0 , import_react.createContext) is not a function
    at eval (webpack-internal:///(sc_server)/./node_modules/@aptos-labs/wallet-adapter-react/dist/index.js:39:52)
    at Object.(sc_server)/./node_modules/@aptos-labs/wallet-adapter-react/dist/index.js (/home/homefolder/dev/project/web_app/frontend/.next/server/app/home/page.js:579:1)
    at __webpack_require__ (/home/homefolder/dev/project/web_app/frontend/.next/server/webpack-runtime.js:33:43)
    at eval (webpack-internal:///(sc_server)/./src/app/components/AppContext.tsx:30:91)
    at Module.(sc_server)/./src/app/components/AppContext.tsx (/home/homefolder/dev/project/web_app/frontend/.next/server/app/home/page.js:1820:1)
    at __webpack_require__ (/home/homefolder/dev/project/web_app/frontend/.next/server/webpack-runtime.js:33:43)
    at eval (webpack-internal:///(sc_server)/./src/app/layout.tsx:12:80)
    at Module.(sc_server)/./src/app/layout.tsx (/home/homefolder/dev/project/web_app/frontend/.next/server/app/home/page.js:1923:1)
    at Function.__webpack_require__ (/home/homefolder/dev/project/web_app/frontend/.next/server/webpack-runtime.js:33:43)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  type: 'TypeError',
  page: '/home'
}

Implementing the old way with pages and _app.tsx has no problems.

@0xmaayan
Copy link
Collaborator

looks like our demo app uses Next version 13.0.0 https://github.com/aptos-labs/aptos-wallet-adapter/blob/main/apps/nextjs-example/package.json#L30 , what is the exact Next version you are trying to use?

@skilldeliver
Copy link
Author

looks like our demo app uses Next version 13.0.0 https://github.com/aptos-labs/aptos-wallet-adapter/blob/main/apps/nextjs-example/package.json#L30 , what is the exact Next version you are trying to use?

yes, I am trying to use the wallet adapter with Next 13.0.0 and the new app directory that I am talking about is this one: https://beta.nextjs.org/docs/routing/fundamentals, looks like your demo app is developed in the old way with pages/

@cylim
Copy link

cylim commented Jan 25, 2024

looks like our demo app uses Next version 13.0.0 https://github.com/aptos-labs/aptos-wallet-adapter/blob/main/apps/nextjs-example/package.json#L30 , what is the exact Next version you are trying to use?

yes, I am trying to use the wallet adapter with Next 13.0.0 and the new app directory that I am talking about is this one: https://beta.nextjs.org/docs/routing/fundamentals, looks like your demo app is developed in the old way with pages/

For any pages that involving the wallets, should be done in browser side. The simple solution is add 'use client' on top of the file imported AptosWalletAdapterProvider.

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

No branches or pull requests

3 participants