Created
June 1, 2026 20:15
-
-
Save jswny/fe6567d43e35f209e0c81373bc17b2f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default { | |
| async fetch(_request, env) { | |
| const startedAt = Date.now(); | |
| // Expected: requestTimeoutMs: 1000 should time out after about 1 second. | |
| // Actual: this returns 200 after ~16-18 seconds when the image completes. | |
| const response = await env.AI.run( | |
| "openai/gpt-image-2", | |
| { | |
| prompt: "A simple red cube on a white table, studio product photo", | |
| quality: "auto", | |
| size: "1024x1024", | |
| output_format: "png" | |
| }, | |
| { | |
| returnRawResponse: true, | |
| gateway: { | |
| id: "default", | |
| metadata: { | |
| app: "sturm", | |
| source: "timeout-repro" | |
| }, | |
| requestTimeoutMs: 1000 | |
| } | |
| } | |
| ); | |
| return Response.json({ | |
| ok: response.ok, | |
| status: response.status, | |
| elapsedMs: Date.now() - startedAt, | |
| aiGatewayLogId: env.AI.aiGatewayLogId ?? null, | |
| body: await response.json() | |
| }); | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment