postgres({ config }) resolves from the working directory, but the guide says relative to the module file
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Read packages/1-prisma-cloud/1-extensions/target/src/orm-postgres.ts, then trace how config reaches resolveOrmConfig in packages/1-prisma-cloud/1-extensions/target/src/descriptors/orm-postgres.ts and loadConfig in packages/1-prisma-cloud/1-extensions/target/src/orm-config.ts. Compare that path handling with the guide and ADR-0004; the issue is resolved when module-relative behavior matches the documented rule or the guide is corrected. The report was inferred from source and was not reproduced.
Written by the indexing model from the issue text.
Description
Composer 0.40.0, prisma/orm 8.0.0-rc.25.
Inferred from source at v0.40.0; not reproduced.
- The guide promises module-relative resolution:
docs/guides/building-an-app.mdlines 240-243, "naming theprisma.config.tspath (relative to the module file) so the deploy can reload the emittedcontract.jsonand findmigrations/". ADR-0004 ("paths resolve relative to the authoring file") states the same rule for authoring paths in general. - The code does not:
PostgresResourceNodekeepsconfigas given (packages/1-prisma-cloud/1-extensions/target/src/orm-postgres.ts). The lowering passes it unchanged,resolveOrmConfig(node.config)(packages/1-prisma-cloud/1-extensions/target/src/descriptors/orm-postgres.tsline 43), which callsloadConfig(configPath)with nocwd(packages/1-prisma-cloud/1-extensions/target/src/orm-config.tsline 51). The ORM resolves a relative path againstprocess.cwd():const cwd = options?.cwd ?? process.cwd(); const resolvedConfigPath = configPath ? resolve(cwd, configPath) : undefined;(prisma/ormv8.0.0-rc.25,packages/1-framework/3-tooling/config-loader/src/load.tslines 276-277).prisma devandprisma deployconverge with the working directory set to where the command ran (packages/0-framework/3-tooling/cli/src/operations/execute-dev.tsline 305, theDEV.WORKER_THREADexplanation;packages/0-framework/3-tooling/cli/src/converge-process.ts). - Composer's own nested example steps around it:
examples/store/modules/catalog/src/module.tsline 20 builds an absolute path,const config = fileURLToPath(new URL('../prisma.config.ts', import.meta.url));. - Effect: a module in a subdirectory that passes
config: './prisma.config.ts', meaning the file beside the module as the guide says, gets theprisma.config.tsin the directory the command runs from instead. A rootmodule.tsbesideprisma.config.ts, run from that directory, works under both readings. - Expected:
configresolves relative to the file that callspostgres(), as the guide and ADR-0004 say, or the guide says otherwise.
Found while writing the Composer docs on prisma.io (prisma/web#8965). The docs do not work around this.
- Dominant language
- TypeScript
- Stars
- 6
- Forks
- 2
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 33
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from prisma/composer
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
tashfeenahmed/freellmapi#2305 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
prime-radiant-inc/evener#8335 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vercel-labs/ui#1921 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 65/100
microsoft/monaco-editor#5626 ·
Maintainers usually reply within 1 day