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

TypeError: fetch failed] { cause: [Error: AggregateError] } #127

Open
tapz opened this issue Dec 5, 2024 · 4 comments
Open

TypeError: fetch failed] { cause: [Error: AggregateError] } #127

tapz opened this issue Dec 5, 2024 · 4 comments

Comments

@tapz
Copy link

tapz commented Dec 5, 2024

Steps to reproduce

const sql = neon(process.env.POSTGRES_URL_NON_POOLING);
return await sql(query, params);

Expected result

Return rows

Actual result

Error

Environment

Vercel Edge Runtime

Logs, links

Work with Kysely and Pool, but this does not work:

const sql = neon(process.env.POSTGRES_URL_NON_POOLING);
return await sql(query, params);
[NeonDbError: Error connecting to database: fetch failed] {
  name: 'NeonDbError',
  severity: undefined,
  code: undefined,
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: undefined,
  line: undefined,
  routine: undefined,
  sourceError: [TypeError: fetch failed] { cause: [Error: AggregateError] }
}
@jawj
Copy link
Collaborator

jawj commented Dec 5, 2024

Thanks for the report.

There's an example project using HTTP on Vercel Edge Functions at https://github.com/neondatabase-labs/neon-vercel-http/blob/main/api/sites.ts, and deployed at https://neon-vercel-http-pn9w6ym59-jawjs-projects.vercel.app.

I just updated it to the latest driver version, and it seems to be working OK.

The first thing to check is probably just that the POSTGRES_URL_NON_POOLING environment variable is populated as expected. If that doesn't help, can you post a minimal test case to help us reproduce the issue?

@jawj jawj mentioned this issue Dec 5, 2024
@tapz
Copy link
Author

tapz commented Dec 5, 2024

@jawj POSTGRES_URL_NON_POOLING works with Kysely, but with one-shot query directly using Neon does not work.

@jawj
Copy link
Collaborator

jawj commented Dec 5, 2024

I'm happy to investigate this but first I need something I can reproduce. As I mentioned, our own example app using http from Vercel Edge Functions is working fine.

@tapz
Copy link
Author

tapz commented Dec 6, 2024

@jawj Maybe this is because I'm running Neon locally in Docker. Also, the query is quite complex and with Kysely executeQuery it tries to use CompressionStream, which is not available in Edge Runtime.

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

2 participants