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

@prisma/photon installation hangs #310

Closed
MichalLytek opened this issue Nov 27, 2019 · 12 comments
Closed

@prisma/photon installation hangs #310

MichalLytek opened this issue Nov 27, 2019 · 12 comments
Assignees
Labels
bug/0-needs-info More information is needed for reproduction. kind/bug A reported bug.
Milestone

Comments

@MichalLytek
Copy link

MichalLytek commented Nov 27, 2019

When I install the fasade package, it hangs for unknown reason on the generate script:

> @prisma/photon@2.0.0-preview017 postinstall F:\#Projekty\#Github\typegraphql-prisma\experiments\node_modules\@prisma\photon
> node scripts/generate.js

I can abort that but then it fails to generate manually using prisma2 generate:

PS F:\#Projekty\#Github\typegraphql-prisma\experiments> npm run generate

> @ generate F:\#Projekty\#Github\typegraphql-prisma\experiments
> prisma2 generate

> Downloading windows binary for query-engine [] 100%     

Generating Photon.js to ./node_modules\@prisma\photon     
Error: Error: EBUSY: resource busy or locked, copyfile 'F:\#Projekty\#Github\typegraphql-prisma\experiments\node_modules\@prisma\photon\runtime\browser-chalk.d.ts' -> 'F:\#Projekty\#Github\typegraphql-prisma\experiments\node_modules\@prisma\photon\runtime\browser-chalk.d.ts'

If I remove all the files it complains about, it stops on \node_modules\@prisma\photon\runtime\index.js and I can't remove that because then Error: Cannot find module './runtime' 😕

If I provide a custom output path, it generates without any issue, but then it fails on making a query:

  photon Request: +0ms
  photon query {
  photon   findManyUser {
  photon     id
  photon     email
  photon     name
  photon     age
  photon     balance
  photon     amount
  photon     role
  photon   }
  photon } +0ms
  photon Request: +30ms
  photon query {
  photon   findManyPost {
  photon     uuid
  photon     createdAt
  photon     updatedAt
  photon     published
  photon     title
  photon     content
  photon     kind
  photon   }
  photon } +23ms
  engine { PRISMA_DML_PATH:
  engine    'F:\\#Projekty\\#Github\\typegraphql-prisma\\experiments\\prisma\\generated\\photon\\schema.prisma',    
  engine   PORT: '54951',
  engine   RUST_BACKTRACE: '1',
  engine   RUST_LOG: 'info',
  engine   LOG_QUERIES: 'true',
  engine   OVERWRITE_DATASOURCES: '[]' } +0ms
  engine { cwd:
  engine    'F:\\#Projekty\\#Github\\typegraphql-prisma\\experiments\\prisma' } +3ms
  engine:log { timestamp: 2001-11-27T10:29:35.689Z,
  engine:log   level: 'INFO',
  engine:log   target: 'prisma',
  engine:log   fields:
  engine:log    { message: 'Encountered error during initialization:',
  engine:log      'log.target': 'prisma',
  engine:log      'log.module_path': 'prisma',
  engine:log      'log.file': 'query-engine/prisma/src/main.rs',
  engine:log      'log.line': 130 } } +0ms
  engine connect ECONNREFUSED 127.0.0.1:54951 +9s

I can provide more details if needed 😉

@timsuchanek timsuchanek self-assigned this Nov 27, 2019
@timsuchanek timsuchanek added bug/2-confirmed We have confirmed that this is a bug. kind/bug A reported bug. labels Nov 27, 2019
@timsuchanek timsuchanek added this to the Preview 18 milestone Nov 27, 2019
@timsuchanek
Copy link
Contributor

Thanks for reporting @MichalLytek!
As confirmed in Slack, this is fixed in the latest alpha.

@timsuchanek
Copy link
Contributor

The query still fails, so I reopened this.

@MichalLytek
Copy link
Author

Everything works now, closing 😄

@clayrisser
Copy link

It's definitely getting stuck on 2.0.0-preview017.1

@MichalLytek
Copy link
Author

@timsuchanek
Both 2.0.0-preview017.1 and 2.0.0-preview017.2 hangs on the node_modules\@prisma\photon > node scripts/generate.js 😕

It doesn't hang when I install in on root typegraphql-prisma that doesn't have prisma2 dependency installed - it prints the In order to use "@prisma/photon", please install prisma2 error end exit 😉

@timsuchanek
Copy link
Contributor

Thanks, @MichalLytek! Can you please describe a reproduction of how to get to the described problem?

@pantharshit00 pantharshit00 added bug/0-needs-info More information is needed for reproduction. and removed bug/2-confirmed We have confirmed that this is a bug. labels Dec 11, 2019
@MichalLytek
Copy link
Author

MichalLytek commented Dec 13, 2019

My repository is always the best reproduction 😄
https://github.com/MichalLytek/type-graphql/tree/prisma

Get a Windows machine, clone the repo, go to experiments folder and run npm i - it hangs even on 018.2 preview release 😕

image

Side note: it can hang even after printing the version missmatch error

@timsuchanek
Copy link
Contributor

Perfect! I'll have a look 🙂

@timsuchanek
Copy link
Contributor

It turns out, that this neither related to Windows, nor to Photon.js.
The typegraphql generator you have defined in https://github.com/MichalLytek/type-graphql/blob/prisma/experiments/prisma/schema.prisma#L15 simply hangs.
If I removed that generator block, it didn't hang anymore.

I've done a small improvement in the postinstall hook of @prisma/photon:

  1. Renamed scripts/generate.js to scripts/postinstall.js just to make it clearer.
  2. Enabled the logging of the command that is being executed (in this case prisma2 generate simply hangs)

@MichalLytek
Copy link
Author

Oh, this makes sense. I think my generator tries to read photon dmmf but it's not already installed/generated yet? I will need to add some logging to file to be able to debug the generator execution.

@jkb-kt
Copy link

jkb-kt commented Dec 17, 2019

I am not using typegraphql and it hangs as well after updating to 2.0.0-preview018.2. Works fine on 2.0.0-preview015.

EDIT.: The difference I have just noticed is that for my system it downloads debian-openssl-1.1.x in case of 2.0.0-preview018.2 and linux-glibc-libssl1.1.0 for 2.0.0-preview015.

@janpio
Copy link
Contributor

janpio commented Dec 17, 2019

Please create a new issue for this @cypcz if you still encounter this problem. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug/0-needs-info More information is needed for reproduction. kind/bug A reported bug.
Projects
None yet
Development

No branches or pull requests

6 participants