-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
client:reactIssues relating to the React client SDKIssues relating to the React client SDKquestionThe issue is a question. Please use Stack Overflow for questions.The issue is a question. Please use Stack Overflow for questions.
Description
Bug: useCubeQuery fails with 403 error – Authorization header is undefined
Description
This issue occurs when running the app using npm run start (i.e., in production mode).
When using @cubejs-client/react versions between 0.39.0 and 1.3.39 on React 19 with Next.js, the useCubeQuery hook fails with a 403 error due to a missing authorization header (Authorization: undefined). However, accessing the cubeApi object directly via useContext(CubeContext) works as expected and contains the cubeApi correctly initalized (with correct url and token).
Works
import { CubeContext } from "@cubejs-client/react";
const contextValue = useContext(CubeContext);
const cubeApi = contextValue.cubeApi;
console.log(cubeApi) // --> Contains a valid token and url Fails
import { useCubeQuery } from "@cubejs-client/react";
const { resultSet } = useCubeQuery(...); // → 403 error, auth header is undefinedSteps to Reproduce
- Use React 19.1.0 with Next.js 15.4
- Wrap components with CubeProvider and attempt to use useCubeQuery
- Run the app using npm run build and then npm run start (in dev mode it works)
- Observe a 403 response due to a missing Authorization header
jedymatt and juniusfree
Metadata
Metadata
Assignees
Labels
client:reactIssues relating to the React client SDKIssues relating to the React client SDKquestionThe issue is a question. Please use Stack Overflow for questions.The issue is a question. Please use Stack Overflow for questions.