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

Unhandled Runtime Error: adapter is not a function #6133

Closed
nabilAparicio opened this issue Jan 18, 2024 · 1 comment · Fixed by #6214
Closed

Unhandled Runtime Error: adapter is not a function #6133

nabilAparicio opened this issue Jan 18, 2024 · 1 comment · Fixed by #6214

Comments

@nabilAparicio
Copy link

Bug Report
Describe the Bug
I am encountering an issue with MedusaJS when executing requests on NextJS Edge runtime. The bug seems to be associated with Axios, displaying the error: 'Unhandled Runtime Error: adapter is not a function.'

System Information
Medusa Version: "@medusajs/medusa-js": "^6.1.5", "medusa-react": "^9.0.13"
Node.js Version: [Not relevant]
Database: [Not relevant]
Operating System: [Not relevant]
Browser: [Not relevant]

Steps to Reproduce the Behavior
Initialize a Next.js project.
Install medusajs and medusa-react.
Initialize an instance of a MedusaJS client.
Switch Page runtime to edge
Attempt to fetch data using a method such as medusaClient.products.list().

Expected Behavior
The expectation is to successfully fetch data in the same manner as when using a Node.js runtime environment.

Screenshots
yarn run dev
image

yarn build
yarn start

image

Code Snippets
A minimal repository reproducing the bug can be found here: MedusaJS Minimal Bug Reproduction

@lekterable
Copy link

same issue here

@kodiakhq kodiakhq bot closed this as completed in #6214 Jan 25, 2024
kodiakhq bot pushed a commit that referenced this issue Jan 25, 2024
**What**

- Adds the ability to pass an Axios adapter through the client's config.

**Why**

- When using NextJS with the edge runtime for deployment on Cloudflare Pages, for example, Axios does not work. Therefore, it is necessary to pass an adapter like [@vespaiach/axios-fetch-adapter](https://github.com/vespaiach/axios-fetch-adapter).

**How**

- Receives the **axiosAdapter** in the config and implements it when creating the **axiosClient**.

Closes #6133
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants