Under prisma dev, MIGRATION_PATH_NOT_FOUND advises prisma db update, but the failed dev has already stopped the database

オープン
#468 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
67/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
bun, node.js, postgresql, typescript
領域
backend, cli, database

調査の方向性

Start with noPathRefusal() in packages/1-prisma-cloud/1-extensions/target/src/orm-migrate.ts, the source identified in the issue, and compare the advice shown for prisma dev with the deploy behavior. Reproduce the steps by changing contract.prisma, running prisma contract emit and prisma dev --detach, then checking whether the suggested prisma db update flow can access the database. Done means the error guidance matches an action a user can take in this state.

索引モデルが issue の本文から書いたものです。

説明

Reproduced on 2026-11-30 on macOS, Node.js 24.13.0, Bun 1.3.13, with Composer 0.40.0, prisma 8.0.0-rc.36 and @prisma/orm-postgres 8.0.0-rc.25.

The app

Versions installed (package.json):

{
  "type": "module",
  "dependencies": {
    "@prisma/composer": "0.40.0",
    "@prisma/composer-prisma-cloud": "0.40.0",
    "@prisma/orm-postgres": "8.0.0-rc.25",
    "arktype": "^2.2.9",
    "pg": "8.22.0",
    "prisma": "8.0.0-rc.36"
  },
  "devDependencies": {
    "@types/pg": "8.20.0",
    "@types/bun": "1.3.13",
    "typescript": "6.0.3"
  }
}

The app

contract.prisma:

// use prisma-8

model Quote {
  id   Int    @id @default(autoincrement())
  text String
}

prisma.config.ts:

import { defineConfig as composer } from '@prisma/composer/config';
import { nodeBuild } from '@prisma/composer/node/control';
import { prismaCloud, prismaState } from '@prisma/composer-prisma-cloud/control';
import { defineConfig as orm } from '@prisma/orm-postgres/config';
import { definePrismaConfig } from 'prisma/config';

export default definePrismaConfig({
  composer: composer({
    entry: './module.ts',
    extensions: [prismaCloud(), nodeBuild()],
    state: prismaState(),
  }),
  orm: orm({
    contract: './contract.prisma',
  }),
});

src/data.ts:

import { dataContract } from '@prisma/composer-prisma-cloud/orm';
import type { Contract } from '../contract.d.ts';
import contractJson from '../contract.json' with { type: 'json' };

export const quotesData = dataContract<Contract>(contractJson);

src/service.ts:

import { rawHttpContract } from '@prisma/composer/http';
import node from '@prisma/composer/node';
import { compute } from '@prisma/composer-prisma-cloud';
import { postgres } from '@prisma/composer-prisma-cloud/orm';
import { quotesData } from './data.ts';

export default compute({
  name: 'quotes',
  deps: { db: postgres(quotesData) },
  build: node({ module: import.meta.url, entry: '../dist/server.mjs' }),
  expose: { http: rawHttpContract },
});

module.ts:

import { appRoot } from '@prisma/composer';
import { publicUrl } from '@prisma/composer-prisma-cloud';
import { postgres } from '@prisma/composer-prisma-cloud/orm';
import { quotesData } from './src/data.ts';
import quotesService from './src/service.ts';

export default appRoot('quotes-app', ({ provision }) => {
  const db = provision(
    postgres({ name: 'database', contract: quotesData, config: './prisma.config.ts' }),
  );
  const quotes = provision(quotesService, { deps: { db } });
  provision(publicUrl({ id: 'site', url: publicUrl.prismaBuild(), target: quotes.http }));
});

src/server.ts is a Bun.serve fetch handler that reads and writes db.client.orm.public.Quote (the file is in the scratch folder; any server that listens on service.port() reproduces both defects). It is built with bun build src/server.ts --target=bun --outfile dist/server.mjs.

The first repro ran with an earlier module.ts without the publicUrl() line and a service.ts without expose; the defects do not depend on either.

Steps, starting from the app after the first prisma dev --detach above (one migration applied, app running):

  1. Add author String? to Quote in contract.prisma.
  2. Run:
npx prisma contract emit
npx prisma dev --detach

prisma contract emit prints storageHash: 68a11edd3f76d3812ccb19d59671c91e9c24b2b1dbc178f287c01668a95d1047. prisma dev --detach fails (the same message is printed for quotes-app.quotes.deployment, quotes-app.quotes.env.COMPOSER_QUOTES_APP_QUOTES_DB_URL and quotes-app.database.migration; the final lines are):

✘ converge
✘ [DEV.CONVERGE_FAILED] The app could not be converged.
OrmMigrationError: Prisma ORM migrate (MIGRATION_PATH_NOT_FOUND): The committed migrations/ directory has no authored path from the database's current schema (6cffa1794b3ecbb1e2f75485fc7326de48d6f0555308d18046ba1c495f529a6a) to the target — the deploy pipeline only replays authored migrations, it never creates schema itself. Iterating locally? Bring the database along with `prisma db update`. Shipping? Author the migration path — `prisma contract emit && prisma migration plan --name <slug>` (baseline first if the migration graph is empty) — and commit migrations/. (Current contract has no planned migration path)
  docs: https://www.prisma.io/docs/cli/error-reference/DEV.CONVERGE_FAILED
  1. Follow the advice: get the local database's connection string to pass to prisma db update --db:
npx prisma dev url quotes-app.database

It exits with code 2 and prints:

✘ [DEV.NOT_RUNNING] The database "quotes-app.database" is stopped.
  why: `prisma dev stop` and `prisma dev` ending both stop an app's services and database servers, and a stopped node has no URL that answers.
→ Run `prisma dev` in this directory.
  docs: https://www.prisma.io/docs/cli/error-reference/DEV.NOT_RUNNING

npx prisma emulator list shows the instance as stopped. I also ran prisma dev in the foreground in the same state. It exited, and dev url quotes-app.database afterwards gave the same DEV.NOT_RUNNING (I did not capture that run's own output). Running prisma dev again, as DEV.NOT_RUNNING suggests, meets the same unplanned contract, so a user who follows "Iterating locally? Bring the database along with prisma db update" has no database to update.

Expected: either the advice that prisma dev prints is something it allows (for example, the database stays up after a migration refusal, or dev offers a way to start only the databases), or the message under prisma dev does not suggest prisma db update.

The source of the message is noPathRefusal() in packages/1-prisma-cloud/1-extensions/target/src/orm-migrate.ts at v0.40.0, which serves deploy and dev with the same text.

Found while writing the Composer database docs on prisma.io. The docs do not repeat this advice.

主要言語
TypeScript
スター
6
フォーク
2
平均マージ
1日 2時間
マージ済み PR(30日)
33

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

prisma/composer のほかの issue

prisma/composer の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。