Missing Croct context
Resolve the error about the missing Croct request context.
If a loader or action throws an error like the one below, the SDK could not find the visitor context on the load context it received:
Error
Croct’s request context is missing. Did you configure Croct’s middleware (React Router) or createCroctContext (Remix)?
This happens when the request context was never resolved for the request, so the functions that fetch content and evaluate expressions have no visitor to act on.
Solution
Wire the request context for your setup, as described in the manual installation guide:
- On React Router 7, register the middleware on your root route.
- On Remix, build the context with the context helper in your getLoadContext wrapper and merge it under the Croct key.
If you already wired it, make sure the loader or action reads the same context argument it receives, and that the middleware is registered on the root route so it runs for every request.