question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

prisma generate is blocked by query-engine-rhel-openssl-1.0.x opening in Notepad on Windows

See original GitHub issue

Bug description

When I run prisma generate two instances of Notepad are launched, which block prisma generate from completing until I close them

image

Until I close those two windows, it will just stand there waiting.

Just as a test I did this, and it did get rid of the problem, but also doesn’t generate the binary targets I need… image

How to reproduce

This is the command I run

$ node_modules/.bin/prisma generate --schema=api/db/schema.prisma

This is what my schema looks like

datasource DS {
  // optionally set multiple providers
  // example: provider = ["sqlite", "postgresql"]
  provider = "sqlite"
  url      = env("DATABASE_URL")
}

generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "rhel-openssl-1.0.x"]
}

model Post {
  id        Int      @id @default(autoincrement())
  createdAt DateTime @default(now())
}

Expected behavior

I expect prisma generate to run to completion without launching Notepad

Prisma information

See above

Environment & setup

  • OS: Windows 10 10.0.19041
  • Database: SQLite
  • Node.js version: 14.4.0
  • Prisma version: 2.9.0
$ node_modules/.bin/prisma -v
@prisma/cli          : 2.9.0
@prisma/client       : 2.9.0
Current platform     : windows
Query Engine         : query-engine 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules\@prisma\cli\query-engine-windows.exe)
Migration Engine     : migration-engine-cli 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules\@prisma\cli\migration-engine-windows.exe)
Introspection Engine : introspection-core 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules\@prisma\cli\introspection-engine-windows.exe)
Format Binary        : prisma-fmt 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules\@prisma\cli\prisma-fmt-windows.exe)
Studio               : 0.296.0

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
janpiocommented, Jun 25, 2021

(Debugged a very similar problem for https://github.com/prisma/prisma/issues/7693#issuecomment-868814030 - so took a look at this one as well)

Turns out it is trying to get the version of that binary in the process: https://github.com/prisma/prisma/blob/ad8f073b83ddd9fd6a57c01fa7ac16d75a69f0a7/src/packages/sdk/src/engine-commands/getVersion.ts#L17-L28

For the Windows one that works of course, but the Rhel or Debian one of course can not be executed on Windows - and that popups opens.

We probably want to add something here that it knows about the current platform and the platform of the binary, and only tries to execute this for the ones that can be executed as they are the same platform.

Possibly that can already happen in the loop that calls the method above in the first place: https://github.com/prisma/prisma/blob/9c287b3d45ae721f463b682651bd778cfab9d05a/src/packages/client/src/generation/generateClient.ts#L252-L295

If that version check fails, it just copies the file anyway - so on the wrong platform it could just default to that: https://github.com/prisma/prisma/blob/9c287b3d45ae721f463b682651bd778cfab9d05a/src/packages/client/src/generation/generateClient.ts#L283-L293 (The catch makes sure when it can not get a version, it returns null, but of course there the popup is already open)

1reaction
janpiocommented, May 19, 2021

Which means it is something in the generate process, that is trying to use the Debian (wrong) binary to execute for something. Wild guess: Probably some getConfig or dmmf or similar.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generating the client (Concepts) - Prisma
This page explains how to generate Prisma Client. It also provides additional context on the generated client, typical workflows and Node.js configuration.
Read more >
Prisma CLI Command Reference
The generate command generates assets like Prisma Client based on the generator and data model blocks defined in your prisma/schema.prisma file.
Read more >
Generators (Reference) - Prisma
A generator determines which assets are created when you run the prisma generate command. The main property provider defines which Prisma Client (language ......
Read more >
Prisma schema (Reference)
prisma migrate dev : Reads the data sources and data model definition to create a new migration. You can also use environment variables...
Read more >
Prisma engines
The query engine is also copied to the generated Prisma Client when you call prisma generate . You might want to use a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found