SDK's `getGenerator` function's `binaryPathsOverride` does not return the binary/library it downloaded
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 47.6k
- Forks
- 2.5k
- Avg merge
- 21h 59m
- Merged PRs (30d)
- 95
Description
Bug description
SDK's getGenerators function accepts a binaryPathsOverride parameter to override the binary/library it uses. If neither a library or binary path override is given, it is supposed to download the correct thing and return the path to the thing it downloaded. But currently, if both overrides are omitted, then getGenerator downloads the correct thing, but does not return the path to the thing it downloaded.
How to reproduce
I use getGenerators like so:
import { getGenerator } from '@prisma/sdk`
const useBinary = false;
const useLibrary = false;
const prismaClientGenerator = await getGenerator({
schemaPath: this.schemaPath,
binaryPathsOverride: {
queryEngine: useBinary ? "<custom-path>" : undefined
libqueryEngineNapi: useLibrary ? "<custom-path>" : undefined
}
})
In this case, prismaClientGenerator.options.binaryPaths does not contain the path to the binary / library that this function downloaded. Instead, prismaClientGenerator.options.binaryPaths is { queryEngine: { darwin: undefined } }
However, if I call this function like so:
import { getGenerator } from '@prisma/sdk`
const useBinary = false;
const useLibrary = false;
const prismaClientGenerator = await getGenerator({
schemaPath: this.schemaPath,
binaryPathsOverride: queryEngine
? {
[useBinary
? 'queryEngine'
: 'libqueryEngineNapi']: "<custom-path>",
}
: undefined
})
then all is good. It seems overriding individual properties inside binaryPathsOverride causes this problem, but setting binaryPathsOverride itself does not.
Expected behavior
prismaClientGenerator.options.binaryPaths should be:
{
queryEngine: { darwin: "<path-to-downloaded-binary>" }
}
or
{
libqueryEngineNapi: { darwin: "<path-to-downloaded-binary>" }
}
in both cases.
Prisma information
Not relevant
Environment & setup
Not relevant, but
- OS: macOS
- Database: Postgres
- Node.js version: v14.17.0
Prisma Version
Irrelevant, but:
@prisma/sdk's version is: 2.25.0-dev.32
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the @prisma/sdk getGenerator entry point and trace how binaryPathsOverride is combined with the downloaded path. Reproduce the case where both individual overrides are undefined, then verify that options.binaryPaths contains the downloaded queryEngine or libqueryEngineNapi path in the expected shape.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100