Skip to content

Build fails with TypedSQL enabled due to directory layout #1325

Closed

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.

Activity

  1. changed the title [-]Build fails with TypedSQL enabled[/-] [+]Build fails with TypedSQL enabled due to directory layout[/+] on Sep 19, 2024
  2. deleted a comment from gorbak25 on Sep 19, 2024
  3. nicktrn commented on Sep 19, 2024

    @nicktrn
    Collaborator

    Reported and deleted a potential malware link. Sorry, had to delete your reply as well as it quoted the link and would have still been accessible via edit history.

    @ericallam is probably best suited to look into your issue. Thanks for reporting it 🙏

  4. ericallam commented on Sep 19, 2024

    @ericallam
    Member

    Thanks for the report, I'll look into this 👍

  5. added a commit that references this issue on Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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