You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Sveltekit app and I am using https://github.com/geoffrich/svelte-adapter-azure-swa adapter to deploy to Azure Static Web App. The app has an API built-in (/chat/api) and I am calling it from the front end. The API makes a call to Azure OpenAI and streams the data back to front end. The frontend loads fine, however when it makes the call to the API it returns an error (screenshot below). I am able to replicate the issue locally on the emulator using SWA CLI and I see below error.
Repro steps
Under src/routes/chat/api, have a +server.ts file with a POST endpoint which is something like this.
The data is streamed back to the front end/client.
Actual behavior
Error as below
[2024-08-10T11:39:47.676Z] Executing 'Functions.sk_render' (Reason='This function was programmatically called via the host APIs.', Id=915b21cb-c9b5-4992-b0b2-5ffd012c2f46)
[2024-08-10T11:39:49.299Z] Executed 'Functions.sk_render' (Failed, Id=915b21cb-c9b5-4992-b0b2-5ffd012c2f46, Duration=1629ms)
[2024-08-10T11:39:49.299Z] System.Private.CoreLib: Exception while executing function: Functions.sk_render. System.Private.CoreLib: Result: Failure
[2024-08-10T11:39:49.299Z] Exception: Received non-Uint8Array chunk
[2024-08-10T11:39:49.299Z] Stack: TypeError: Received non-Uint8Array chunk
[2024-08-10T11:39:49.299Z] at readAllBytes (node:internal/deps/undici/undici:4417:17)
[2024-08-10T11:39:49.299Z] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[2024-08-10T11:39:49.299Z] at async fullyReadBody (node:internal/deps/undici/undici:4381:22)
[2024-08-10T11:39:49.299Z] at async consumeBody (node:internal/deps/undici/undici:5463:7)
[2024-08-10T11:39:49.299Z] at async toResponse (/Users/utkarsh/_DEV/GitHub/onlyutkarsh/km/build/server/sk_render/index.js:162301:34)
[2024-08-10T11:39:49.299Z] at async Object.index4 (/Users/utkarsh/_DEV/GitHub/onlyutkarsh/km/build/server/sk_render/index.js:162277:20).
POST http://localhost:4280/api/__render - 500
Known workarounds
Provide a description of any known workarounds.
Related information
Provide any related information
Static Web App Hosting Plan: Standard
Programming language used: SvelteKit and Typescript
Investigative information
I have a Sveltekit app and I am using
https://github.com/geoffrich/svelte-adapter-azure-swa
adapter to deploy to Azure Static Web App. The app has an API built-in (/chat/api
) and I am calling it from the front end. The API makes a call to Azure OpenAI and streams the data back to front end. The frontend loads fine, however when it makes the call to the API it returns an error (screenshot below). I am able to replicate the issue locally on the emulator using SWA CLI and I see below error.Repro steps
Under
src/routes/chat/api
, have a+server.ts
file with a POST endpoint which is something like this.Start the app using
swa
CLI (swa start
), and using any REST Client, make a call to local API and you get the above error.I have following SWA CLI config for local
Expected behavior
The data is streamed back to the front end/client.
Actual behavior
Error as below
Known workarounds
Provide a description of any known workarounds.
Related information
Provide any related information
SvelteKit and Typescript
4.0.5907 Commit hash: N/A +807e89766a92b14fd07b9f0bc2bea1d8777ab209 (64-bit)
4.834.3.22875
The text was updated successfully, but these errors were encountered: