-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
error Error: Invariant: Method expects to have requestAsyncStorage, none available at addItem (./components/cart/actions.ts:17:71) #1164
Comments
Same here |
This issue has been troubling me so bad |
I've replaced File: import Cookies from 'js-cookie';
import { getCart } from 'lib/shopify';
import CartModal from './modal';
export default async function Cart() {
const cartId = Cookies.get('cartId');
let cart;
if (cartId) {
cart = await getCart(cartId);
}
return <CartModal cart={cart} />;
} |
@xInfinitYz
At first this logs
not working either |
Can one or some of you run |
Also possibly related... vercel/next.js#53331 What if y'all change all instances of Obviously that is not the ideal fix, but it would help us troubleshoot and isolate the issue. |
@manovotny
And yes, the Thank you for allowing me to work with more ease |
I was hitting this issue on Windows and the only way I could resolve it is to launch dev within WSL |
Output from
|
So far it seems like a Windows + Edge issue. I'll see if I can whip up a minimal reproduction. |
Lol, yes, Windows was the one to blame this whole time |
Do post back if you find a nicer/faster way of working. I'm not finding working through WSL that bad, but if there is a speedier way to work, I'd love to know 👍 |
To anyone coming back to this, js-cookie will not accomplish a full solution for cart. I've only been able to get this working moving to running the server from WSL, which is not ideal. |
any updates on this for windows? |
I don't know much about this but seems like the problem is Nextjs itself |
Right now your options are to buy a Mac, install WSL, find an alternative cookie header library, or dig into the issue and open a PR. I think this is a problem with next/headers cookie implementation though and nothing in the eCommerce package. Right now I'm just rolling with WSL. |
What I did was changing |
Im getting this error when i m trying to add product in local
POST http://localhost:3000/product/surf-turf?delivery+date=2+Jul 500 (Internal Server Error)
fetchServerAction @ server-action-reducer.js:27
await in fetchServerAction (async)
serverActionReducer @ server-action-reducer.js:96
clientReducer @ router-reducer.js:49
eval @ use-reducer-with-devtools.js:63
updateReducerImpl @ react-dom.development.js:11508
updateReducer @ react-dom.development.js:11346
useReducer @ react-dom.development.js:13099
useReducer @ react.development.js:1789
useReducerWithReduxDevtoolsImpl @ use-reducer-with-devtools.js:102
Router @ app-router.js:172
renderWithHooks @ react-dom.development.js:10855
updateFunctionComponent @ react-dom.development.js:15893
beginWork$1 @ react-dom.development.js:18102
beginWork @ react-dom.development.js:26476
performUnitOfWork @ react-dom.development.js:25327
workLoopConcurrent @ react-dom.development.js:25313
renderRootConcurrent @ react-dom.development.js:25269
performConcurrentWorkOnRoot @ react-dom.development.js:24122
workLoop @ scheduler.development.js:261
flushWork @ scheduler.development.js:230
performWorkUntilDeadline @ scheduler.development.js:537
3redirect-boundary.js:61 Uncaught Error: Invariant: Method expects to have requestAsyncStorage, none available
at cookies (webpack-internal:///(actionBrowser)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/client/components/headers.js:46:15)
at addItem (webpack-internal:///(actionBrowser)/./components/cart/actions.ts:17:71)
at endpoint (webpack-internal:///(actionBrowser)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/build/webpack/loaders/next-flight-action-entry-loader.js?actions=%5B%5B%22C%3A%5C%5CEXCELOID%20-%20AVINASH%5C%5CNextJS%20Commerce%5C%5CShopify%5C%5C08-08-2023%5C%5Cdev%5C%5Ccommerce%5C%5Ccomponents%5C%5Ccart%5C%5Cactions.ts%22%2C%5B%22addItem%22%2C%22removeItem%22%2C%22updateItemQuantity%22%5D%5D%5D&client_imported=true!:10:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async eval (webpack-internal:///(ssr)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/esm/server/app-render/action-handler.js:224:35)
at async handleAction (webpack-internal:///(ssr)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/esm/server/app-render/action-handler.js:174:13)
at async wrappedRender (webpack-internal:///(ssr)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/esm/server/app-render/app-render.js:1146:37)
The text was updated successfully, but these errors were encountered: