Uncaught TypeError: Cannot destructure property 'store' of 't(...)' as it is null.
Unanswered
Harish Garg 🥱 posted this in #help-forum
Mine Nextjs website is working great in development env and also in local build env. But when I deploy this on the vercel I start getting this error for certain links
You can visit my website at www.spraykaro.com
And the error is in pages https://www.spraykaro.com/products and https://www.spraykaro.com/brands/insecticides-india-limited?category=crop-protection
heres the error logs
I am using rtlk with redux-thunk
You can visit my website at www.spraykaro.com
And the error is in pages https://www.spraykaro.com/products and https://www.spraykaro.com/brands/insecticides-india-limited?category=crop-protection
heres the error logs
TypeError: Cannot destructure property 'store' of 't(...)' as it is null.
at n (828-bc719130ca305620.js:9:1625)
at c (global-error-9bbcd2664dcf8ccc.js:1:334)
at rk (fd9d1056-f07d7af7ef7b98db.js:1:40371)
at iB (fd9d1056-f07d7af7ef7b98db.js:1:116380)
at o4 (fd9d1056-f07d7af7ef7b98db.js:1:94633)
at fd9d1056-f07d7af7ef7b98db.js:1:94455
at o3 (fd9d1056-f07d7af7ef7b98db.js:1:94462)
at oQ (fd9d1056-f07d7af7ef7b98db.js:1:91949)
at oj (fd9d1056-f07d7af7ef7b98db.js:1:91374)
at MessagePort.w (9145-20ddde36f65047bb.js:6:29386)Uncaught TypeError: Cannot destructure property 'store' of 't(...)' as it is null.
at n (828-bc719130ca305620.js:9:1625)
at c (global-error-9bbcd2664dcf8ccc.js:1:334)
at rk (fd9d1056-f07d7af7ef7b98db.js:1:40371)
at iB (fd9d1056-f07d7af7ef7b98db.js:1:116380)
at o4 (fd9d1056-f07d7af7ef7b98db.js:1:94633)
at fd9d1056-f07d7af7ef7b98db.js:1:94455
at o3 (fd9d1056-f07d7af7ef7b98db.js:1:94462)
at oQ (fd9d1056-f07d7af7ef7b98db.js:1:91949)
at oj (fd9d1056-f07d7af7ef7b98db.js:1:91374)
at MessagePort.w (9145-20ddde36f65047bb.js:6:29386)I am using rtlk with redux-thunk
8 Replies
Yes bro added all the required env variables
I cant handle this error as the error is not providing any location, also the link is working fine for all other brands but just giving error for this https://www.spraykaro.com/brands/insecticides-india-limited?category=crop-protection only
I cant handle this error as the error is not providing any location, also the link is working fine for all other brands but just giving error for this https://www.spraykaro.com/brands/insecticides-india-limited?category=crop-protection only
@Harish Garg 🥱 Yes bro added all the required env variables
I cant handle this error as the error is not providing any location, also the link is working fine for all other brands but just giving error for this https://www.spraykaro.com/brands/insecticides-india-limited?category=crop-protection only
add a try catch and atleast inform the client about the err for now
console.log the err also
export const metadata: Metadata = {
title: "Products",
};
const ProductsList = async ({
searchParams,
}: {
searchParams: {
category: string;
};
}) => {
let query;
if (searchParams.category === undefined) {
query = qs.stringify({
populate: ["Variants", "Thumbnail", "brand"],
});
}
if (searchParams.category !== undefined) {
const categories = searchParams.category?.split(",") || [];
query = qs.stringify({
filters: {
$and: [
{
categories: {
slug: categories[0],
},
},
{
categories: {
slug: categories[1],
},
},
{
categories: {
slug: categories[2],
},
},
],
},
populate: ["Variants", "Thumbnail", "brand"],
});
}
let data: Product[] = [];
try {
const res = await api.get(`/api/products?${query}`);
data = res?.data?.data;
// console.log(res?.data?.data);
} catch (error: any) {
console.log(error?.response?.data);
}
return data.length === 0 ? (
<NotFound />
) : (
<div className="py-4">
<div className="bg-primary/50 py-10 mb-12">
<h1 className="text-3xl font-bold text-center">Products</h1>
</div>
<div className="pageContainer">
<div className="productsGrid">
{data.map((product) => (
<div key={product?.id}>
<ProductCard productData={product} />
</div>
))}
</div>
</div>
</div>
);
};
export default ProductsList;This is the code of /products and I am try catching every error . The error is actually a client side error only and I am unable to find the source of this error
try running
npm run build and npm run start locallyIf you're facing any other issue(which could be a different post), don't hesitate to ping and let me know!