Commit ae5de08
committed
fix(pearl): correct SSE error event format and fix infinite loading on missing API key
Three related bugs fixed:
1. Wrong SSE error event shape in backend routes
- bubble-flows.ts and ai.ts were sending { type: 'error', error: '...' }
- StreamingEvent schema requires { type: 'error', data: { error, recoverable } }
- Frontend handler reads event.data.error, so errors silently fell back to
'An error occurred' or were swallowed entirely
2. Missing error event on coffee agent failure (planning phase)
- When GOOGLE_API_KEY is absent, coffee.ts returns early with success:false
- The route only sent stream_complete with the error buried in coffeeResult
- No error SSE event was emitted, so the frontend never received it
3. UI stuck in infinite loading state when API key is missing
- generationAbortController was never cleared after the stream ended
- isGenerating stayed true forever since setGenerationCompleted was never called
- Added stream_complete error handling in handleStreamingEvent as a fallback
- Added safety net in startGenerationStream to always clear isGenerating after
the stream loop exits without a generation_complete event1 parent 06974f8 commit ae5de08
File tree
4 files changed
+61
-15
lines changed- apps
- bubble-studio/src/hooks
- bubblelab-api/src/routes
4 files changed
+61
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
427 | | - | |
428 | | - | |
429 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
430 | 446 | | |
431 | 447 | | |
432 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
224 | 229 | | |
225 | 230 | | |
226 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
153 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
154 | 158 | | |
155 | 159 | | |
156 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
516 | 518 | | |
517 | 519 | | |
518 | 520 | | |
| |||
1416 | 1418 | | |
1417 | 1419 | | |
1418 | 1420 | | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
1419 | 1438 | | |
1420 | 1439 | | |
1421 | 1440 | | |
| |||
1690 | 1709 | | |
1691 | 1710 | | |
1692 | 1711 | | |
1693 | | - | |
1694 | | - | |
1695 | | - | |
1696 | | - | |
1697 | | - | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
1698 | 1719 | | |
1699 | 1720 | | |
1700 | 1721 | | |
| |||
0 commit comments