Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: emitted patterns for engine resolution #9295

Merged
merged 1 commit into from
Sep 17, 2021

Conversation

netlify-team-account-1
Copy link
Contributor

prisma generate currently results in these lines to be emitted:

const dirname = findSync(process.cwd(), [
  '"node_modules/.prisma/client"',
  '".prisma/client"',
], ['d'], ['d'], 1)[0] || __dirname

There's one pair of quotes too much, which causes findSync to not find anything. Since dirname is used to resolve the location of the Prisma engine, it's important that it is passed correct parameters. At the moment, it will never find anything and resort to __dirname, breaking deploy for some bundlers.

This can be fixed by removing the outer quotes, as JSON.stringify will already emit the double-quotes that mark it as a string literal.

See netlify/zip-it-and-ship-it#630 for reference.

Before, these lines resulted in the following to be emitted:

```js
const dirname = findSync(process.cwd(), [
  '"node_modules/.prisma/client"',
  '".prisma/client"',
], ['d'], ['d'], 1)[0] || __dirname
```

There's one pair of quotes too much, which causes `findSync` to not find anything. Since `dirname` is used to resolve the location of the Prisma engine, it's important that it is passed correct parameters.

This can be fixed by removing the outer quotes, as `JSON.stringify` will already emit the double-quotes that mark it as a string literal.

Related to netlify/zip-it-and-ship-it#630.
@CLAassistant
Copy link

CLAassistant commented Sep 16, 2021

CLA assistant check
All committers have signed the CLA.

@netlify-team-account-1 netlify-team-account-1 changed the title Fix emitted patterns for engine resolution bug: Fix emitted patterns for engine resolution Sep 16, 2021
@netlify-team-account-1 netlify-team-account-1 changed the title bug: Fix emitted patterns for engine resolution fix: emitted patterns for engine resolution Sep 16, 2021
@Jolg42
Copy link
Member

Jolg42 commented Sep 16, 2021

Nice catch and thanks for the PR!

@Jolg42 Jolg42 added this to the 3.1.0 milestone Sep 16, 2021
@millsp millsp merged commit 3983485 into prisma:main Sep 17, 2021
@FredericEspiau
Copy link
Contributor

#8698 well I guess I can close mine then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants