I had this same issue and it ended up being solved by upgrading to Hydrogen 2. It’s seemingly a vite / router issue which was removed and replaced by remix in the newest version.
Topic summary
A developer is unable to query metaobjects using Hydrogen’s useShopQuery hook in a fresh Storefront API installation.
Setup:
- Created a metaobject definition called “featured_images” in Shopify Admin to store an image and product reference
- Attempting to fetch metaobjects using GraphQL query with
useShopQuery
Issue:
The query fails with a “Failed to connect to the Storefront API: 200 OK” error, despite receiving a 200 status code. The error appears to be related to Hydrogen’s internal routing/server handling rather than the API itself.
Resolution:
A community member reported experiencing the same issue and resolved it by upgrading to Hydrogen 2. They noted this was a Vite/router issue in the older version, which has since been removed and replaced by Remix in the newest Hydrogen version.
Recommendation:
Upgrade to Hydrogen 2 to resolve the metaobject querying issue.