Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hi, I m building a storefront with Hydrogen.
I just created a metaobject but i m getting an error when i try to fetch it with graphql. It's weird because i allowed the acces from storefront.
It work perfectly with the graphiQL explorer app installed in my shopify store:
but when i fetch it with this code
import { gql, useShopQuery } from '@shopify/hydrogen'
export default function Tester() {
const { data } = useShopQuery({ query: METAOBJECT_QUERY })
return <div>Test</div>
}
const METAOBJECT_QUERY = gql`
query metaobj {
metaobject(id: "gid://shopify/Metaobject/20873484") {
id
fields {
key
value
}
}
}
`
I get this error " Failed to connect to the Storefront API: 200 OK "