{"record":{"id":"984b5c7570cc7f1c","repo":"nextauthjs/next-auth","slug":"hasura-client-error-please-provide-a-graphql-endp","errorCode":null,"errorMessage":"Hasura client error: Please provide a graphql endpoint","messagePattern":"Hasura client error: Please provide a graphql endpoint","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapter-hasura/src/lib/client.ts","lineNumber":30,"sourceCode":"\nexport class HasuraClientError extends Error {\n  name = \"HasuraClientError\"\n  constructor(\n    errors: any[],\n    query: TypedDocumentString<any, any>,\n    variables: any\n  ) {\n    super(errors.map((error) => error.message).join(\"\\n\"))\n    console.error({ query, variables })\n  }\n}\n\nexport function client({ adminSecret, endpoint }: HasuraAdapterClient) {\n  if (!adminSecret)\n    throw new TypeError(\"Hasura client error: Please provide an adminSecret\")\n\n  if (!endpoint)\n    throw new TypeError(\n      \"Hasura client error: Please provide a graphql endpoint\"\n    )\n\n  return {\n    async run<\n      Q extends TypedDocumentString<any, any>,\n      T extends Q extends TypedDocumentString<infer T, any> ? T : never,\n      V extends Q extends TypedDocumentString<any, infer V> ? V : never,\n    >(query: Q, variables?: V): Promise<T> {\n      const response = await fetch(endpoint, {\n        method: \"POST\",\n        headers: {\n          \"Content-Type\": \"application/json\",\n          \"x-hasura-admin-secret\": adminSecret,\n        },\n        body: JSON.stringify({ query, variables }),\n      })\n","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/nextauthjs/next-auth/blob/a1a16a5a7780488c7449feece410033f445d0b31/packages/adapter-hasura/src/lib/client.ts#L12-L48","documentation":"The Hasura adapter client needs the GraphQL endpoint URL to send queries. If HasuraAdapter options omit endpoint (or it is empty), client() throws this TypeError at construction. This is a pure configuration validation error thrown before any network call.","triggerScenarios":"HasuraAdapter({ adminSecret }) without endpoint; endpoint: process.env.HASURA_ENDPOINT with the env var unset; typos in the env var name; building the options object conditionally and dropping endpoint.","commonSituations":"Deploying to a new environment (staging/preview) without copying HASURA_ENDPOINT; mixing up GraphQL vs console URLs; forgetting NEXT_PUBLIC/runtime env configuration in serverless platforms.","solutions":["Set endpoint to the Hasura GraphQL URL (e.g. https://<project>.hasura.app/v1/graphql) in HasuraAdapter options","Ensure the environment variable is defined in the deployment environment and actually loaded at runtime","Verify the URL is the /v1/graphql endpoint, not the console or metadata URL","Fail fast at startup with an assertion if endpoint is missing"],"exampleFix":"// before\nHasuraAdapter({ adminSecret: process.env.HASURA_ADMIN_SECRET! })\n// after\nHasuraAdapter({\n  adminSecret: process.env.HASURA_ADMIN_SECRET!,\n  endpoint: process.env.HASURA_ENDPOINT!,\n})","handlingStrategy":"validation","validationCode":"if (!process.env.HASURA_ENDPOINT) {\n  throw new Error('HASURA_ENDPOINT is not set')\n}\nconst adapter = HasuraAdapter({\n  endpoint: process.env.HASURA_ENDPOINT,\n  adminSecret: process.env.HASURA_ADMIN_SECRET!,\n})","typeGuard":"function isValidEndpoint(v: unknown): v is string {\n  return typeof v === 'string' && v.startsWith('http') && v.includes('/v1/graphql')\n}","tryCatchPattern":"try {\n  const adapter = HasuraAdapter({ adminSecret, endpoint: process.env.HASURA_ENDPOINT! })\n} catch (e) {\n  if (e instanceof TypeError && e.message.includes('graphql endpoint')) {\n    console.error('HASURA_ENDPOINT must point to /v1/graphql')\n  } else throw e\n}","preventionTips":["Set HASURA_ENDPOINT in every environment (dev/staging/prod)","Point to the /v1/graphql URL, not the console URL","Validate endpoint shape at boot","Add adapter construction to a smoke test"],"tags":["hasura","config","missing-env-var","url"],"backgroundTag":"missing-env-var","analyzedSha":"a1a16a5a7780488c7449feece410033f445d0b31","analyzedAt":"2026-08-28T21:52:38.200Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}