400 No Shop Provided error when querying products in sample app

Hey everyone,

I am probably overlooking something very trivial here, but I can’t figure it out. In the sample app from the tutorial, there’s a fairly straightforward way to query for the products count:

const {
    data: productCountData,
    refetch: refetchProductCount,
    isLoading: isLoadingCount,
    isRefetching: isRefetchingCount,
  } = useAppQuery({
    url: "/api/products/count",
    reactQueryOptions: {
      onSuccess: () => {
        setIsLoading(false);
      },
    },
  });

Makes sense and checks out given the documentation for this endpoint.

However, when I want to query for the actual products themselves (I have some in the store of course), I always get a “400 Bad request” with a response body “No Shop provided”.

const {
    data: productData,
      } = useAppQuery({
    url: "/api/products/all",
    reactQueryOptions: {
      onSuccess: () => {
        /* ... */
      },
    },
  });

I have provided all different spelling combinations (without all etc.) that could have been the culprit, but to no avail. Also, the aforementioned documentation does not mention any need to include a shop id or so (I have also tried specific product ids for what it’s worth, no dice). What am I missing?

Kind regards!

1 Like