Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Unclear error when we guess a binary #478

Closed
divyenduz opened this issue Feb 10, 2020 · 1 comment
Closed

Unclear error when we guess a binary #478

divyenduz opened this issue Feb 10, 2020 · 1 comment
Assignees
Labels
bug/2-confirmed We have confirmed that this is a bug. kind/bug A reported bug.
Milestone

Comments

@divyenduz
Copy link

divyenduz commented Feb 10, 2020

To reproduce:

Deploy this project with Netlify's beta build (https://build-beta.netlify.com/). It should fail since we do not specify any binary targets and CI OS of Netlify is different from function runtime of Netlify.

So, the download happens in the build CI, which downloads the binary: query-engine-debian-openssl-1.0.x

At the runtime though, we need the binary for rhel-openssl-1.0.x.

That's where the maybe compatible kicks in and tries to run the available binary (only linux, hence this is hard to reproduce on a mac, windows machine).

The errors in the log is descriptive:

1:49:38 PM: 2020-02-10T12:49:38.605Z	b35ec6bb-f8be-4e38-9444-7c734e8e9d81	ERROR	warning Prisma Client could not resolve the needed binary for the current platform rhel-openssl-1.0.x.
Instead we found /var/task/src/node_modules/@prisma/client/runtime/query-engine-debian-openssl-1.0.x, which we're trying for now. In case Prisma Client runs, just ignore this message.
1:49:38 PM: 2020-02-10T12:49:38.671Z	b35ec6bb-f8be-4e38-9444-7c734e8e9d81	ERROR	Invoke Error 	{"errorType":"Error","errorMessage":"\nInvalid `prisma.()` invocation in\n/var/task/src/functions/index.js:6:36\n\n\n\nEngine exited {\"target\":\"exit\",\"timestamp\":\"2020-02-10T12:49:38.642Z\",\"level\":\"error\",\"fields\":{\"message\":\"127\"}}","stack":["Error: ","Invalid `prisma.()` invocation in","/var/task/src/functions/index.js:6:36","","","","Engine exited {\"target\":\"exit\",\"timestamp\":\"2020-02-10T12:49:38.642Z\",\"level\":\"error\",\"fields\":{\"message\":\"127\"}}","    at PrismaClientFetcher.request (/var/task/src/node_modules/@prisma/client/index.js:82:23)"]}
1:49:38 PM: Duration: 101.52 ms	Memory Usage: 93 MB	

The error from the deployed function though, is not:

{"errorType":"Error","errorMessage":"\nInvalid `prisma.()` invocation in\n/var/task/src/functions/index.js:6:36\n\n\n\nEngine exited {\"target\":\"exit\",\"timestamp\":\"2020-02-10T12:49:38.642Z\",\"level\":\"error\",\"fields\":{\"message\":\"127\"}}","trace":["Error: ","Invalid `prisma.()` invocation in","/var/task/src/functions/index.js:6:36","","","","Engine exited {\"target\":\"exit\",\"timestamp\":\"2020-02-10T12:49:38.642Z\",\"level\":\"error\",\"fields\":{\"message\":\"127\"}}","    at PrismaClientFetcher.request (/var/task/src/node_modules/@prisma/client/index.js:82:23)"]}

Just surfacing the error from the logs should be enough.

To get rid of this error specifically in Netlify, we can use a generator configuration like this:

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

Related issue: #475 prisma/prisma#1086

@divyenduz divyenduz added bug/2-confirmed We have confirmed that this is a bug. kind/bug A reported bug. process/candidate Candidate for next Milestone. labels Feb 10, 2020
@janpio janpio added this to the Preview 22 milestone Feb 10, 2020
@janpio janpio removed the process/candidate Candidate for next Milestone. label Feb 10, 2020
@timsuchanek
Copy link
Contributor

Thanks a lot for reporting 🙏
This issue is fixed in the latest alpha version of prisma2.
You can try it out with npm i -g prisma2@alpha.

In case it’s not fixed for you - please let us know and we’ll reopen this issue!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug/2-confirmed We have confirmed that this is a bug. kind/bug A reported bug.
Projects
None yet
Development

No branches or pull requests

3 participants