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

'then' in PrimsaPromise returns false #12252

Closed
hayes opened this issue Mar 10, 2022 · 0 comments · Fixed by #12255
Closed

'then' in PrimsaPromise returns false #12252

hayes opened this issue Mar 10, 2022 · 0 comments · Fixed by #12255
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. tech/typescript Issue for tech TypeScript. topic: fluent api topic: prisma-client
Milestone

Comments

@hayes
Copy link
Contributor

hayes commented Mar 10, 2022

Bug description

Some libraries use 'then' in x as part of their detection for promise-like/thenable objects.

The way prisma client builds its fluent APIs with proxies causes this to fail.

How to reproduce

console.log('then' in prisma.someModel.findUnique({ where: { id: 1 }))

console.log(typeof prisma.someModel.findUnique({ where: { id: 1 })).then === 'function')

This is basically because ownKeys here

const ownKeys = getOwnKeys(client, dmmfModelName)
does not include then (or other promise methods)

Expected behavior

'then' in promise should return true.

Prisma information

Environment & setup

  • OS:
  • Database:
  • Node.js version:

Prisma Version

prisma                  : 3.10.0
@prisma/client          : 3.10.0
Current platform        : darwin
Query Engine (Node-API) : libquery-engine 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at ../../node_modules/.pnpm/@prisma+engines@3.10.0-50.73e60b76d394f8d37d8ebd1f8918c79029f0db86/node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine        : migration-engine-cli 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at ../../node_modules/.pnpm/@prisma+engines@3.10.0-50.73e60b76d394f8d37d8ebd1f8918c79029f0db86/node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine    : introspection-core 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at ../../node_modules/.pnpm/@prisma+engines@3.10.0-50.73e60b76d394f8d37d8ebd1f8918c79029f0db86/node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary           : prisma-fmt 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at ../../node_modules/.pnpm/@prisma+engines@3.10.0-50.73e60b76d394f8d37d8ebd1f8918c79029f0db86/node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash    : 73e60b76d394f8d37d8ebd1f8918c79029f0db86
Studio                  : 0.458.0
@hayes hayes added the kind/bug A reported bug. label Mar 10, 2022
@hayes hayes changed the title 'then' in PromisePromise returns false 'then' in PrimsaPromise returns false Mar 10, 2022
@Jolg42 Jolg42 added topic: prisma-client tech/typescript Issue for tech TypeScript. team/client Issue for team Client. topic: fluent api bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. process/candidate labels Mar 11, 2022
@millsp millsp added bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Mar 11, 2022
@Jolg42 Jolg42 added this to the 3.11.0 milestone Mar 14, 2022
benweatherman pushed a commit to apollographql/federation that referenced this issue Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. tech/typescript Issue for tech TypeScript. topic: fluent api topic: prisma-client
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants