coinbase / coinbase/onchainkit

Bug: TypeError: createContext is not a function with Next.js 14.x and React 18.2.0

Open
#2,364 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1k
Forks
520
Avg merge
32m
Merged PRs (30d)
2

Description

### Describe the bug and the steps to reproduce it

When using @coinbase/onchainkit@0.38.13 with Next.js 14.x and React 18.2.0, I get the following error on startup:

TypeError: (0 , react__WEBPACK_IMPORTED_MODULE_1__.createContext) is not a function
at .../node_modules/@coinbase/onchainkit/dist/nft/components/NFTProvider.js

This happens even in a minimal, clean Next.js app.

**Steps to reproduce:**
1. Create a new Next.js app:
npx create-next-app@latest clean-test
2. cd clean-test
3. Install dependencies:
npm install react@18.2.0 react-dom@18.2.0 @coinbase/onchainkit@0.38.13
4. Add a minimal page that imports and uses NFTMintCard from OnchainKit.
5. Run `npm run dev` and visit http://localhost:3000
6. The error appears and the app fails to render.

### What's the expected behavior?

The app should start and render the NFTMintCard component without any errors.

### What version of the libraries are you using?

- OnchainKit: 0.38.13
- Next.js: 14.2.3
- React: 18.2.0
- react-dom: 18.2.0
- Node: (your node version, e.g. v20.x.x)
- OS: macOS (Darwin 24.4.0)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure in a minimal Next.js app using the listed React, Next.js, and OnchainKit versions, then inspect node_modules/@coinbase/onchainkit/dist/nft/components/NFTProvider.js and the NFTMintCard entry point. Done means the clean app starts with npm run dev and renders NFTMintCard without the createContext TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, react, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.