Closed bmartinezg closed 1 year ago
I'm having a Isuue like this with nextjs 14.
I upgrade this repo with yarn upgrade-interactive --latest
and fix the types and tansktack/query
(useMutation
etc) usage. So I got this Issue.
TypeError: this[#x].defaultMutationOptions is not a function
at m.setOptions (/Users/moises.desenvolvedor/Apps/medusajs/luz-da-lua-storefront/.next/server/chunks/9472.js:1:278116)
at new m (/Users/moises.desenvolvedor/Apps/medusajs/luz-da-lua-storefront/.next/server/chunks/9472.js:1:277925)
at /Users/moises.desenvolvedor/Apps/medusajs/luz-da-lua-storefront/.next/server/chunks/9472.js:1:279339
at r8 (/Users/moises.desenvolvedor/Apps/medusajs/luz-da-lua-storefront/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:28:32037)
at Object.useState (/Users/moises.desenvolvedor/Apps/medusajs/luz-da-lua-storefront/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:28:34009)
at t.useState (/Users/moises.desenvolvedor/Apps/medusajs/luz-da-lua-storefront/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:60:7030)
at useMutation (/Users/moises.desenvolvedor/Apps/medusajs/luz-da-lua-storefront/.next/server/chunks/9472.js:1:279326)
at eU (/Users/moises.desenvolvedor/Apps/medusajs/luz-da-lua-storefront/.next/server/chunks/9472.js:1:323376)
at wm (/Users/moises.desenvolvedor/Apps/medusajs/luz-da-lua-storefront/.next/server/chunks/9472.js:1:325613)
@bmartinezg It should be compatible! We use it in this starter, which is currently at Next 13. Could be something wrong with your config. Check out src/modules/providers/index.tsx and src/lib/config.ts for a working example.
@moigamijunior When are you getting this error? I've updated to Next 14 locally (manual upgrade by bumping the package version) and got no errors so far. I'll do some more testing and then merge the update.
@VariableVic thanks for your quick replay! Something about I got confused in the starter FE template is that both SDKs (JS and React) are implemented. Should I use both as in the example to go through this error? Thanks again.
@bmartinezg Nope, both SDKs should be usable independently of each other. Can you share your queryClient
config? Are you instantiating it properly?
@VariableVic I realized the error was on react-query
v5. It's working on Next 14 without issues.
I updated to next 14 and so far works. Thanks for the help!
I am currently trying to set up my own front for an ecommerce with next13. To do this, I have installed the react sdk and I am following the documentation.
When I try to use a hook:
I get the following error;
Do I have to use sdkjs instead? or is it compatible with next?
Thanks in advance!