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

feat(medusa-js): add axios adapter to config #6214

Merged
merged 4 commits into from
Jan 25, 2024
Merged

feat(medusa-js): add axios adapter to config #6214

merged 4 commits into from
Jan 25, 2024

Conversation

SirRodney
Copy link
Contributor

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.

How

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

Closes #6133

@SirRodney SirRodney requested review from a team as code owners January 24, 2024 18:27
Copy link

changeset-bot bot commented Jan 24, 2024

⚠️ No Changeset found

Latest commit: 1396e62

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jan 24, 2024

@SirRodney is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@carlos-r-l-rodrigues carlos-r-l-rodrigues left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kodiakhq kodiakhq bot merged commit bf11252 into medusajs:develop Jan 25, 2024
11 of 15 checks passed
@srindom srindom removed the automerge label Jan 25, 2024
@lekterable
Copy link

when is this going out?

sorry to tag you directly @srindom, but I'm on 6.1.6 (latest) and this issue prevents me from using the @medusajs/medusa-js package completely (patch-packaging would be quite difficult with all this minified code)

I'd appreciate a quick resolution, thanks!

@olivermrbl
Copy link
Contributor

olivermrbl commented Feb 9, 2024

@lekterable, this PR was missing a changeset on merge, so the version was not bumped in the recent release. I'll add one manually and release the package as soon as possible. I hope to be able to do this later today.

@olivermrbl
Copy link
Contributor

@lekterable, new release is out. Please try @medusajs/medusa-js@6.1.7 and let me know :)

@lekterable
Copy link

thanks for such a quick response @olivermrbl, but seems like the issue is still there :(

any ideas? I updated the package version, cleaned up node_modules and reinstalled

  "dependencies": {
    "@headlessui/react": "1.7.18",
    "@heroicons/react": "2.1.1",
    "@medusajs/medusa": "1.20.2",
    "@medusajs/medusa-js": "6.1.7",
    "@medusajs/ui": "2.4.0",
    "@next/third-parties": "14.1.0",
    "@stripe/react-stripe-js": "2.4.0",
    "@stripe/stripe-js": "2.4.0",
    "@tanstack/react-query": "4.22",
    "@vercel/analytics": "1.1.3",
    "clsx": "2.1.0",
    "medusa-react": "9.0.15",
    "next": "14.1.0",
    "react": "18.2.0",
    "react-country-flag": "3.1.0",
    "react-dom": "18.2.0",
    "tailwind-merge": "2.2.0"
  },
image

@lekterable
Copy link

ah I see now, we are required to pass this adapter ourselves, I tried adding the one which is mentioned in description (https://github.com/vespaiach/axios-fetch-adapter) and now I get a different error

suggestion: maybe we could just ship it with some default adapter for easy usage?

image

@zaidrashid
Copy link
Contributor

Hi @lekterable , how do you instantiate the adapter and added in the Medusa configuration? Do you have any code examples that I can take a look at?

Also, any chance you have managed tp solve the issue by now?

Thanks

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

Successfully merging this pull request may close these issues.

Unhandled Runtime Error: adapter is not a function
6 participants