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

error: ResolveMessage after upgrade to v 3.4.0 #692

Closed
masfahru opened this issue Oct 11, 2023 · 5 comments · Fixed by #709
Closed

error: ResolveMessage after upgrade to v 3.4.0 #692

masfahru opened this issue Oct 11, 2023 · 5 comments · Fixed by #709

Comments

@masfahru
Copy link

masfahru commented Oct 11, 2023

Runtime : bun 1.0.4+745b6b94ee56cad24d475799690cc9a89957d15b

Updating Postgres.js from 3.3.5 to 3.4.0, but then I got an error: ResolveMessage when executing a query.

ResolveMessage {
  stack: "undefined\n    at cachedError (/home/fahru/github-collections/postgres/node_modules/postgres/cf/src/query.js:171:27)\n    at new Query (/home/fahru/github-collections/postgres/node_modules/postgres/cf/src/query.js:35:47)\n    at sql (/home/fahru/github-collections/postgres/node_modules/postgres/cf/src/index.js:115:37)\n    at module code (/home/fahru/github-collections/postgres/index.ts:15:2)",
  query: undefined,
  parameters: undefined,
  args: [],
  types: null,
  code: undefined,
  importKind: undefined,
  level: undefined,
  message: undefined,
  position: undefined,
  referrer: undefined,
  specifier: undefined,
  toJSON: [Function: toJSON],
  toString: [Function: toString],
  name: "ResolveMessage",
  [Symbol(Symbol.toPrimitive)]: [Function: toPrimitive]
}

Code to reproduce

import postgres from 'postgres';

const sql = postgres({
  host: 'random-generated-host.ap-southeast-1.aws.neon.tech',
  port: 5432,
  username: 'user_name',
  password: 'strong_password',
  database: 'database_name',
  ssl: true,
  max: 1,
  transform: postgres.camel,
});

await sql`SELECT id, "name", batch, migration_time FROM knex_migrations`.then((res) => {
  console.info(res)
  return res
}).catch((error) => {
  console.error(error)
})

It works on v 3.3.5
image

@codewith-luke
Copy link

Can confirm, seeing the same behavior in Bun as well since the upgrade.

@porsager
Copy link
Owner

Why oh why is bun choosing the worker export (that is meant for CloudFlare)🫣 I'll look a little closer.

@Ychop
Copy link

Ychop commented Oct 13, 2023

Same here with bun 1.0.6 for Postgres.js 3.3.5 and 3.4.0

@lukeed
Copy link
Contributor

lukeed commented Oct 23, 2023

Bun checks for bun -> worker -> node -> require -> import -> default

https://bun.sh/docs/runtime/modules#importing-packages

@porsager
Copy link
Owner

porsager commented Oct 23, 2023

Thanks a lot @lukeed - I'll add a specific pointer for bun so it doesn't grab the cloudflare one

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

Successfully merging a pull request may close this issue.

5 participants