Query Sanity from Netlify Edge Function

Hey team,

I have a Shopify Hydrogen site which pulls content from Sanity. The site works as expected locally.
I have used the @netlify/hydrogen-platform module to support a Netlify build/deploy.

The site builds as expected but at run time, the edge functions make a query to Sanity which returns undefined.
The same query works for me locally.

Is there some config I am missing to enabled CMS requests from and edge function?

Alternatively, can I prevent Edge Function deploys for hydrogen and simply use a basic function?

Thanks,

Fergus

Site name: https://nz-single-speed.netlify.app/
Source code: GitHub - fergusfrl/i18n-hydrogen-sanity

Issue found.

@sanity/client returns an error when executing on Netlify Edge functions. I switched the Sanity client to use picosanity instead which has solved this problem.

Thanks so much for coming back and letting us know-- glad that you found a solution and are on the right track. Happy building :rocket: