Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails with Error: The script will never generate a response. on cloudflare pages #1013

Open
abhishiv opened this issue Jan 21, 2025 · 0 comments

Comments

@abhishiv
Copy link

abhishiv commented Jan 21, 2025

This is similar to #865, however unlike in that issue I create the postgres client on each request and still get following error on cloudflare pages with "compatibility_flags": ["nodejs_compat"]

✘ [ERROR] 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.
[wrangler:inf] GET /api/test 500 Internal Server Error (8ms)
✘ [ERROR] Uncaught (in response) Error: The script will never generate a response.

Using it as follows

app.get("/api/test", async (c) => {
  console.log("test route");
  const sql = postgres(c.env.DATABASE_URL);
  const users = await sql`
    select *
    from users`;
  // users = Result [{ name: "Walter", age: 80 }, { name: 'Murray', age: 68 }, ...]
  return c.json(users);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant