commerce
commerce copied to clipboard
[SALEOR] BUILD ERROR OCCURED: Specified images.domain should be an array.
As per the documents I changed the env variables
COMMERCE_PROVIDER=@vercel/commerce-saleor
NEXT_PUBLIC_SALEOR_API_URL=http://0.0.0.0:8000/graphql/ NEXT_PUBLIC_SALEOR_CHANNEL=default-channel
I then did yarn in the root folder.
After that i ran yarn dev in both the root folder as well as the /site/ folder and always get the same error.
next-commerce:dev: Error: Specified images.domains should be an Array of strings received invalid values (). next-commerce:dev: See more info here: https://nextjs.org/docs/messages/invalid-images-config next-commerce:dev: at assignDefaults (/Users/hargunsingh/Desktop/kyssa-farms/User-app/commerce/node_modules/next/dist/server/config.js:206:23) next-commerce:dev: at Object.loadConfig [as default] (/Users/hargunsingh/Desktop/kyssa-farms/User-app/commerce/node_modules/next/dist/server/config.js:439:16) next-commerce:dev: at async NextServer.loadConfig (/Users/hargunsingh/Desktop/kyssa-farms/User-app/commerce/node_modules/next/dist/server/next.js:116:22) next-commerce:dev: at async NextServer.prepare (/Users/hargunsingh/Desktop/kyssa-farms/User-app/commerce/node_modules/next/dist/server/next.js:98:24) next-commerce:dev: at async /Users/hargunsingh/Desktop/kyssa-farms/User-app/commerce/node_modules/next/dist/cli/next-dev.js:130:9 next-commerce:dev: error Command failed with exit code 1. next-commerce:dev: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. next-commerce:dev: Error: command finished with error: exit status 1
Am i doing something wrong or is this a possible bug?
Hey! It looks like you're not passing the right data in your next.config.js
file, could you show us what you're passing? You should be passing the CDN url of the images.
Hey! It looks like you're not passing the right data in your
next.config.js
file, could you show us what you're passing? You should be passing the CDN url of the images.
I was having the same issue as this, but I added COMMERCE_IMAGE_HOST=127.0.0.1:8000 to my .env.local and that got past t hat so I can run it. (The COMMERCE_IMAGE_HOST is not in the .env.template which is needed to run even the demo version.
However, once I get past that and go to the site, I get this new erorr:
error - ..\packages\saleor\dist\api\operations\get-all-products.js (24:0) @ CommerceAPICore.getAllProducts TypeError: Cannot read properties of null (reading 'products') 22 | if (featured) { 23 | var ref, ref1;
24 | const products = ((ref = data.collection.products) === null || ref === void 0 ? void 0 : (ref1 = ref.edges) === null || ref1 === void 0 ? void 0 : ref1.map(({ node: p })=>normalizeProduct(p) 25 | )) ?? []; 26 | return { 27 | products
Can also add that after doing what @RyanTamulevicz did with adding COMMERCE_IMAGE_HOST
, I'm getting the same error as well.
Hey there! I had the same issue from @RyanTamulevicz.
I set the COMMERCE_IMAGE_HOST=localhost
as I'm using macOS, and on the file site/pages/index.tsx
, I changed the featured
param to false
, which worked for me.
I've had all the issues above at different points. Managed to fix them all one way or another except for the null collection issue but reading the comment from dilvane gave me the idea of what could be wrong.
Think it's fair to say that the landing page should list only the featured products and not everything so keep featured
as true in site/pages/index.tsx
.
The real issue with listing the featured products is the collection id for featured collection hardcoded in the package.
You need to login to the dashboard and get the collection id form it's url

In my case it is Q29sbGVjdGlvbjoz
Then go to this path packages/saleor/src/api/operations/get-all-products.ts
and fix the category id.

Rebuild the package by running this from project root
yarn workspace @vercel/commerce-saleor build
And Bob's your uncle from there. Hope this helps someone.
add COMMERCE_IMAGE_HOST
in env.local
Example:
COMMERCE_PROVIDER=@vercel/commerce-saleor
NEXT_PUBLIC_SALEOR_API_URL=https://vercel.saleor.cloud/graphql/
NEXT_PUBLIC_SALEOR_CHANNEL=default-channel
COMMERCE_IMAGE_HOST=vercel.saleor.cloud
Hey there! Thank you for opening this issue. We have decided to take Next.js Commerce in a new direction and will be closing out current PRs and issues due to this change. Please see this PR for more details: https://github.com/vercel/commerce/pull/966