Error in cloudflare workers : Uncaught (in response) Error: The script will never generate a response

Hi I’m getting the following error in Cloudflare workers

A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished. ✘ [ERROR] Uncaught (in response) Error: The script will never generate a response.

My code is simple

import { Client } from '@neondatabase/serverless'
import { Env } from './models'

export default {
    async fetch(request: Request, env: Env, ctx: ExecutionContext) {
        const client = new Client({/*details*/})
        await client.connect()
        const {
            rows: [{ now }]
        } = await client.query('select now();')
        ctx.waitUntil(client.end())
        return new Response(now)
    }
}

About the problem, I have found the following page but it does not mention any solution "The script will never generate a response” on CloudFlare Workers | Zuplo Docs

1 Like

I am also getting this error. I am using the pg (node-postgres) to connect to supabase.