{"record":{"id":"2cebc122d89ab586","repo":"Budibase/budibase","slug":"streaming-not-supported-in-this-browser","errorCode":null,"errorMessage":"Streaming not supported in this browser","messagePattern":"Streaming not supported in this browser","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/frontend-core/src/api/ai.ts","lineNumber":94,"sourceCode":"    })\n  },\n\n  generateJs: async req => {\n    return await API.post({\n      url: \"/api/ai/js\",\n      body: req,\n    })\n  },\n\n  generateTables: async (req, onProgress) => {\n    return await API.post({\n      url: \"/api/ai/tables\",\n      body: req,\n      parseResponse: async response => {\n        try {\n          const reader = response.body?.getReader()\n          if (!reader) {\n            throw new Error(\"Streaming not supported in this browser\")\n          }\n\n          const decoder = new TextDecoder()\n          let buffer = \"\"\n          let finalResponse: GenerateTablesResponse | undefined\n\n          while (true) {\n            const { done, value } = await reader.read()\n            if (done) {\n              break\n            }\n            buffer += decoder.decode(value, { stream: true })\n\n            let boundary = buffer.indexOf(SSE_EVENT_DELIMITER)\n            while (boundary !== -1) {\n              const eventChunk = buffer.slice(0, boundary)\n              buffer = buffer.slice(boundary + SSE_EVENT_DELIMITER.length)\n","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/frontend-core/src/api/ai.ts#L76-L112","documentation":"generateTables streams the AI response via Server-Sent Events and calls response.body.getReader(). If the browser (or fetch polyfill used by the environment) provides no ReadableStream body, `reader` is undefined and this error is thrown because streaming cannot proceed.","triggerScenarios":"Calling buildAIEndpoints.generateTables (POST /api/ai/tables) in a browser or polyfilled fetch environment where response.body is undefined (older browsers, some React Native runtimes, certain polyfills, IE-class browsers).","commonSituations":"Legacy browser support gaps (no ReadableStream), fetch polyfills that don't implement streaming bodies, WebViews with stream support disabled, testing environments (jsdom) whose fetch returns non-streaming responses.","solutions":["Upgrade to a modern browser with ReadableStream support for response.body.getReader().","Remove any fetch polyfill that strips streaming support, or configure undici/native fetch.","Implement a non-streaming fallback path or surface a browser-support message to users.","Check fetch response headers/feature detection (`response.body` exists) before enabling AI table generation in the UI."],"exampleFix":"// before\nconst reader = response.body?.getReader()\n// after\nif (typeof response.body?.getReader !== \"function\") {\n  // fallback: await response.json() via non-streaming endpoint\n  return nonStreamingGenerateTables(req)\n}\nconst reader = response.body.getReader()","handlingStrategy":"fallback","validationCode":"const streamingSupported = typeof Response !== \"undefined\" && typeof Response.prototype?.body?.getReader === \"function\"","typeGuard":"function supportsStreaming(res: Response): res is Response & { body: ReadableStream } {\n  return res.body != null && typeof res.body.getReader === \"function\"\n}","tryCatchPattern":"try {\n  return await generateTables(req)\n} catch (e) {\n  if (e.message === \"Streaming not supported in this browser\") {\n    return nonStreamingGenerateTables(req)\n  }\n  throw e\n}","preventionTips":["Feature-detect ReadableStream/getReader before enabling AI features in the UI","Avoid fetch polyfills that drop streaming body support","Set a browser-support baseline for users of AI features"],"tags":["browser-support","streaming","sse","ai"],"backgroundTag":"streaming-not-supported","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}