Augmenting load context using session data in Cloudflare template #10052
Unanswered
ramiroazar
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We're using Cloudflare Pages and augmenting the load context, but need to access session data in
getLoadContext
.https://remix.run/docs/en/main/guides/vite#augmenting-load-context
Since
getSession
is async, makinggetLoadContext
async and using await infunctions/[[path]].ts
andvite.config.ts
seems to work in development, but fails during the build with the following error.This require call is not allowed because the transitive dependency "[[path]].ts" contains a top-level await
For extra context, I'm trying to follow the instructions below and have got everything working, except for previews which require session data.
https:/sanity-io/hydrogen-sanity?tab=readme-ov-file#usage
The instructions above assume a
server.ts
file like the ones below, but the Cloudflare template from Remix doesn't include one.https:/remix-run/remix/blob/main/templates/cloudflare-workers/server.ts
https:/Shopify/hydrogen/blob/main/templates/skeleton/server.ts
Beta Was this translation helpful? Give feedback.
All reactions