Skip to content

Build fails with TypedSQL enabled due to directory layout #1325

Closed
@gorbak25

Description

@gorbak25

const prismaDir = dirname(schemaDir);

The code in the CLI expects the directory layout to be:

<project_root>/sql - sql files for TypedSQL
<project_root>/<prisma_dir> - prisma directory
<project_root>/<prisma_dir>/<schema_name> - Prisma schema

While in reality the directory layout is:

<project_root>/<prisma_dir> - prisma directory
<project_root>/<prisma_dir>/sql - sql files for TypedSQL
<project_root>/<prisma_dir>/<schema_name> - Prisma schema

This results in builds failing:

✘ [ERROR] Failed to apply extension PrismaExtension onBuildComplete Error: ENOENT: no such file or directory, scandir '/workspaces/mapanfz/sql'

      at async readdir (node:internal/fs/promises:950:18)
      at async PrismaExtension.onBuildComplete
  (/workspaces/mapanfz/node_modules/@trigger.dev/build/dist/commonjs/extensions/prisma.js:75:30)
      at async notifyExtensionOnBuildComplete
  (file:///home/vscode/.npm/_npx/f51a09bd0abf5f10/node_modules/trigger.dev/dist/esm/build/extensions.js:16:17)
      at async buildWorker
  (file:///home/vscode/.npm/_npx/f51a09bd0abf5f10/node_modules/trigger.dev/dist/esm/build/buildWorker.js:70:21)
      at async _deployCommand
  (file:///home/vscode/.npm/_npx/f51a09bd0abf5f10/node_modules/trigger.dev/dist/esm/commands/deploy.js:120:27)
      at async
  file:///home/vscode/.npm/_npx/f51a09bd0abf5f10/node_modules/trigger.dev/dist/esm/commands/deploy.js:77:16
      at async
  file:///home/vscode/.npm/_npx/f51a09bd0abf5f10/node_modules/trigger.dev/dist/esm/cli/common.js:54:28
      at async wrapCommandAction
  (file:///home/vscode/.npm/_npx/f51a09bd0abf5f10/node_modules/trigger.dev/dist/esm/cli/common.js:40:12)
      at async deployCommand
  (file:///home/vscode/.npm/_npx/f51a09bd0abf5f10/node_modules/trigger.dev/dist/esm/commands/deploy.js:76:12)
      at async
  file:///home/vscode/.npm/_npx/f51a09bd0abf5f10/node_modules/trigger.dev/dist/esm/commands/deploy.js:71:13
      at async handleTelemetry
  (file:///home/vscode/.npm/_npx/f51a09bd0abf5f10/node_modules/trigger.dev/dist/esm/cli/common.js:30:9)
      at async Command.<anonymous>
  (file:///home/vscode/.npm/_npx/f51a09bd0abf5f10/node_modules/trigger.dev/dist/esm/commands/deploy.js:69:9)
      at async Command.parseAsync
  (/home/vscode/.npm/_npx/f51a09bd0abf5f10/node_modules/commander/lib/command.js:935:5)
      at async main
  (file:///home/vscode/.npm/_npx/f51a09bd0abf5f10/node_modules/trigger.dev/dist/esm/index.js:5:5) {
    errno: -2,
    code: 'ENOENT',
    syscall: 'scandir',
    path: '/workspaces/mapanfz/sql'
  }

As a workaround I've added /sql to my gitignore and before running the deploy i just copy over the sql folder from the prisma directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions