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

Blitz unable to find/install any recipe when using a proxy #115

Closed
mubaidr opened this issue Apr 12, 2021 · 16 comments · Fixed by blitz-js/blitz#2264
Closed

Blitz unable to find/install any recipe when using a proxy #115

mubaidr opened this issue Apr 12, 2021 · 16 comments · Fixed by blitz-js/blitz#2264

Comments

@mubaidr
Copy link
Contributor

mubaidr commented Apr 12, 2021

What is the problem?

Unable to install any recipes using blitz install. Tried tailwind, material-ui, chakra-ui so far

✕ Could not find recipe "material-ui"

Paste all your error logs here:

$ blitz install material-ui
You are using beta software - if you have any problems, please open an issue here:
      https://github.com/blitz-js/blitz/issues/new/choose

✕ Could not find recipe "material-ui"

Please provide one of the following:

1. The name of a recipe to install (e.g. "tailwind")
   - Available recipes listed at https://github.com/blitz-js/blitz/tree/canary/recipes
2. The full name of a GitHub repository (e.g. "blitz-js/example-recipe"),
3. A full URL to a Github repository (e.g. "https://github.com/blitz-js/example-recipe"), or
4. A file path to a locally-written recipe.

Paste all relevant code snippets here:

blitz install material-ui

What are detailed steps to reproduce this?

  1. blitz new myApp
  2. cd myApp
  3. blitz install material-ui

Run blitz -v and paste the output here:

Linux 5.10 | linux-x64 | Node: v15.14.0

blitz: 0.33.1 (global)
blitz: 0.33.1 (local)

  Package manager: yarn 
  System:
    OS: Linux 5.10 Debian GNU/Linux bullseye/sid
    CPU: (8) x64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
    Memory: 415.45 MB / 7.67 GB
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 15.14.0 - /usr/bin/node
    Yarn: 1.22.10 - /usr/bin/yarn
    npm: 7.9.0 - /usr/local/bin/npm
    Watchman: Not Found
  npmPackages:
    @prisma/client: ~2.19 => 2.19.0 
    blitz: latest => 0.33.1 
    prisma: ~2.19 => 2.19.0 
    react: 0.0.0-experimental-6a589ad71 => 0.0.0-experimental-6a589ad71 
    react-dom: 0.0.0-experimental-6a589ad71 => 0.0.0-experimental-6a589ad71 
    typescript: ~4.1 => 4.1.5
@markhughes
Copy link
Contributor

I've just tried this using node v14.10.1 and didn't have issues.

So using these versions:

$ volta install [email protected]
success: installed and set [email protected] (with [email protected]) as default
$ volta install [email protected]
success: installed and set [email protected] as default
$ volta install [email protected]
success: installed and set [email protected] as default

I also couldn't replicate it.

macOS Big Sur | darwin-x64 | Node: v15.14.0

blitz: 0.33.1 (local)

  Package manager: yarn
  System:
    OS: macOS 11.2.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 239.57 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 15.14.0 - ~/.volta/tools/image/node/15.14.0/bin/node
    Yarn: 1.22.10 - ~/.volta/tools/image/yarn/1.22.10/bin/yarn
    npm: 7.9.0 - ~/.volta/tools/image/npm/7.9.0/bin/npm
    Watchman: Not Found
  npmPackages:
    @prisma/client: ~2.19 => 2.19.0
    blitz: 0.33.1 => 0.33.1
    prisma: ~2.19 => 2.19.0
    react: 0.0.0-experimental-6a589ad71 => 0.0.0-experimental-6a589ad71
    react-dom: 0.0.0-experimental-6a589ad71 => 0.0.0-experimental-6a589ad71
    typescript: ~4.1 => 4.1.5

Is there anything different about your environment? Symbolic links? Weird file system?

Could you try nuking node_modules and running yarn?

@mubaidr
Copy link
Contributor Author

mubaidr commented Apr 12, 2021

I have forgot to mention that I am using proxy for internet. Could this be the issue here that blitz does not support proxy connections?

Proxy is set system wide. Npm, git etc all working fine.

I will also try using fresh install.

@markhughes
Copy link
Contributor

Maybe! I'll try setup a proxy soon myself and see if I can replicate it too

@mubaidr
Copy link
Contributor Author

mubaidr commented Apr 12, 2021

I just tried on a system without proxy and it works fine.

@flybayer flybayer changed the title Blitz unable to find/install any recipe Blitz unable to find/install any recipe when using a proxy Apr 12, 2021
@markhughes
Copy link
Contributor

@mubaidr how are you setting the proxy? Is it through something like yarn config set proxy, or is it on the system level?

@mubaidr
Copy link
Contributor Author

mubaidr commented Apr 13, 2021

I am using proxy on system level. (debian system settings )

Btw I have also setup proxy in npm but it did not work.

@markhughes
Copy link
Contributor

Still trying to work out here how recipes work and I'll hopefully be able to help more!

node -e "https.get('https://raw.githubusercontent.com/blitz-js/blitz/canary/recipes/material-ui/package.json', (res) => {
  res.on('data', (d) => {
    process.stdout.write(d);
  });
}).on('error', (e) => {
  console.error(e);
});"

Can you see if this works from your command line?

@mubaidr
Copy link
Contributor Author

mubaidr commented Apr 13, 2021

node -e "https.get('https://raw.githubusercontent.com/blitz-js/blitz/canary/recipes/material-ui/package.json', (res) => {
res.on('data', (d) => {
process.stdout.write(d);
});
}).on('error', (e) => {
console.error(e);
});"


Can you see if this works from your command line?

Can't test right now, I am on a pc with direct connection. Will test and report as soon as possible.

Some more info:

According to this: nodejs/node#1490 (comment) got (and even nodejs) does not support system level proxy.

Edit 1:
I think that is exactly whats happening, got is unable to connect here: https://github.com/blitz-js/blitz/blob/b18fe2615cbb35ca5170c16ddaff16a4c282b49f/packages/cli/src/commands/install.ts#L19

Also error message should be updated to reveal exactly what is failing, here: https://github.com/blitz-js/blitz/blob/b18fe2615cbb35ca5170c16ddaff16a4c282b49f/packages/cli/src/commands/install.ts#L170

Edit 2:
Also noticed that for single recipe install multiple requests are being made for recipe url. I think this can be cached? or re-used.

@mubaidr
Copy link
Contributor Author

mubaidr commented Apr 13, 2021

I am willing to create a pull request to add proxy support using environment variables. Let me know

@markhughes
Copy link
Contributor

Good call! I didn't see that. It looks like there are a few options: https://github.com/sindresorhus/got#proxies

It looks like it can be set globally on all http/https calls:

https://github.com/gajus/global-agent

Maybe this is something we can do for the CLI @flybayer whats your suggestion on approach? Then @mubaidr could give it a go :)

@flybayer
Copy link
Member

I think let's add them as config items in blitz.config.js. Are there any other cases where we might need proxy config support in blitz?

@markhughes
Copy link
Contributor

@mubaidr did you want me to have a stab at this one?

@mubaidr
Copy link
Contributor Author

mubaidr commented Apr 21, 2021

I don't see any potential candidates that need proxy support (or even connect to internet) other than install command.

I can work on this. Let me know if blitz.config.js is good place for proxy config.

@markhughes
Copy link
Contributor

Yep, blitz.config.js sounds good, and if you get stuck you can jump on discord and someone will help you out! :)

@mubaidr
Copy link
Contributor Author

mubaidr commented Apr 22, 2021

Sure, Thanks.

Also, I think we should also look for proxy environmental variables http_proxy & https_proxy and automatically setup proxy for install command (even if not specified in blitz.config.js)

In short: Enable proxy support in install:

  • If user has specified in config file
  • If user has proxy set globally (environmental)

What do you think?

@flybayer
Copy link
Member

@mubaidr sounds good to me

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

Successfully merging a pull request may close this issue.

4 participants