// Adding a timeout for the put operation
const timeout = new Promise<Response>((_, reject) => {
const id = setTimeout(() => {
clearTimeout(id);
reject(new Response('Request timed out', { status: 408 }));
}, 30000); // 30 seconds timeout
});
const putOperation = c.env.MY_BUCKET.put(key, data);
await Promise.race([timeout, putOperation]);
// Adding a timeout for the put operation
const timeout = new Promise<Response>((_, reject) => {
const id = setTimeout(() => {
clearTimeout(id);
reject(new Response('Request timed out', { status: 408 }));
}, 30000); // 30 seconds timeout
});
const putOperation = c.env.MY_BUCKET.put(key, data);
await Promise.race([timeout, putOperation]);