prisma: Cannot run cli behind proxy
I’ve been trying to follow the getting started tutorial for prisma and have been stuck on the very beginning.
When I try to run the init command:
npx prisma init
I get the following error:
Downloading Prisma engines for windows [ ] 0%
Error: request to https://binaries.prisma.sh/master/76857c35ba1e1764dd5473656ecbbb2f739e1822/windows/query-engine.exe.gz.sha256 failed, reason: connect ECONNREFUSED 13.227.120.121:443
I am currently working under a company proxy which is what I think might be the problem, however I have the environment variables as well as npm configs set correctly and have no idea why this is happening or how to fix it.
I am using a windows machine, as you can tell from the error message. I have tried installing globally but get the same result.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (7 by maintainers)
Update I got it working… had to use
ENV PRISMA_BINARIES_MIRROR http://prisma-builds.s3-eu-west-1.amazonaws.com
For the mirror to work under a company proxy. https does not work under a company proxy even though I can wget to the direct https:// site. Hope theres a real fix for this soon.
Also I did have http_proxy & https_proxy set but still had no luck until I added the above
Final working dockerfile:
Hope this helps others 😄
using prisma generate in a docker image
in case someone still gets this issue, here what I tried :
?sslmode=disable
to db urlDEBUG='*' proxy -p 8180 && HTTP_PROXY=http://localhost:8180/ HTTPS_PROXY=https://localhost:8180/ prisma generate
NODE_TLS_REJECT_UNAUTHORIZED=0
nothing worked until finding this thread with
ENV PRISMA_BINARIES_MIRROR http://prisma-builds.s3-eu-west-1.amazonaws.com
Ahh, you are all switching from our
https
endpoints tohttp
without SSL. That might indeed explain why your local networks do not block requests (although blocking requests to hostnames behind SSL is pretty questionable).It is an actually load balanced and globally distributed hostname that serves the same files as
prisma-builds.s3-eu-west-1.amazonaws.com
.@pantharshit00 Thank you for the quick response.
I had already tried setting the environment variables before, to no avail. Tried again to make sure, but same result.
I can manually download the binaries, so I don’t think my proxy is blocking access to the url.
I managed to workaround the cli downloads by manually downloading the binaries and extracting them to a binaries folder within my project and pointing to them with the environment variables raise to my attention in #1333.
This, however, is not really maintainable, but works for now. When the current alpha version gets released the PRISMA_BINARIES_MIRROR environment variable probably will be the way to go for me.
It worked for me! Thank you!
I’ve spent this whole day trying to get this problem fixed, I tired setting up a node proxy server to forward requests to https://binaries.prisma.sh, but am still stuck with this error…
Error: request to https://binaries.prisma.sh/master/2fb8f444d9cdf7c0beee7b041194b42d7a9ce1e6/debian-openssl-1.1.x/query-engine.gz.sha256 failed, reason: connect ECONNREFUSED 13.226.18.126:443
Would really not like to rewrite all my code without prisma since that would be way too time consuming, any chance a fix like the one described by @ethernal might be coming soon. That way people under corporate proxies won’t run into issues downloading binaries.
The problem is not the CDN links but that, as in my case, your proxy requires authentication. I have not dug into the code yet but WHAT is downloading the binaries? It’s not npm (i have it configured for proxy), if it’s a fetch from a JS/binary file then this would explain things.
One solution (possible?) would be to make an npm packages from binaries and load them as dependencies or just invoke npm/yarn to install them - that way we could have it all working as expected.
The other way around would be need to implement proxy with authentication support for whatever piece of software is downloading the binaries. What do you think @janpio @pantharshit00 ?
PS. it would be good to add the available ENV variables for biaries location in Prisma documentation.
Here it is:
I realize that on the 8th line it says
prisma Environment variables not loaded +6ms
Just in case this is relevant, here are my npm configs:
And my Environment Variables (the relevant ones at least) :
Sorry for the late reply,
Will do, later today when I get to work I’ll post it here.