edgedb / edgedb-cli

The EdgeDB CLI
https://www.edgedb.com/docs/cli/index
Apache License 2.0
164 stars 23 forks source link

edgedb error: failed to fetch JSON at URL `.jsonindexes/aarch64-apple-darwin.json` #1113

Open well1791 opened 10 months ago

well1791 commented 10 months ago

Screenshot

image

Description

Error message

Found `edgedb.toml` in /Users/wmendoza/Code/krew.git/wt/1/krew
Initializing project...
Specify the name of EdgeDB instance to use with this project [default: krew]:
> mine
Checking EdgeDB versions...
edgedb error
  : failed to fetch JSON at URL: https://packages.edgedb.com/archive/.jsonindexes/aarch64-apple-darwin.json
  : error sending request for url (https://packages.edgedb.com/archive/.jsonindexes/aarch64-apple-darwin.json)
  : error trying to connect
  : tcp connect error
  : Operation not permitted (os error 1)
  : error trying to connect
  : tcp connect error
  : Operation not permitted (os error 1)
  : tcp connect error
  : Operation not permitted (os error 1)
  : Operation not permitted (os error 1)

Ok, I've tried uninstalling (removing) all edgedb references then installing them again, I've turned off the firewall just for this operation, I've been running this edgedb project init on fish (default sh), zsh, and bash, and now I'm running out of ideas.

Steps to Reproduce:

  1. edgedb project init

EDIT:

For context, the first time I installed it and ran edgedb project init it worked good, then by mistake I created two projects with similar name, however, I decided to remove both of them so first I did edgedb instance list to get the names and then edgedb instance destroy --force -I name1 and the same for the other one, then I tried edgedb project init again but this time I got the error in the description.

Dhghomon commented 10 months ago

I'm just starting to look at the CLI myself so still a bit unfamiliar but here are some questions and thoughts:

well1791 commented 10 months ago

I assume this error is happening right away? Looks like there is a 60 second timeout but if a connection is stalled there should be some output after 2 seconds which I don't see in your screenshot.

That's correct there's no waiting, it's like a direct reply from the command

Do you see anything interesting if you type edgedb instance logs -I ? Unfortunately I cannot run such command because I have no instances available, I won't be able to have instances unless I run the edgedb project init command first

Deleting edgedb.toml got rid of the confusion in this case. Interesting, I'll try it and let you know how it goes. Also, thanks for your reply 🙇‍♂️

well1791 commented 10 months ago

Hey @Dhghomon, I have a question, do you if know there's a flag that allow the command log a stack trace of the error or anything that provides more context on the bug's nature?

Dhghomon commented 10 months ago

Not that I know of: the only part where I see a backtrace in the code is inside interrupt.rs which is for something else. This does give a sort of trace though as each error gets passed on. The last function in the errors is this one which races the request against a 2-second timer which is why I suspected it was happening right away,

https://github.com/edgedb/edgedb-cli/blob/master/src/portable/repository.rs#L185

and the part that fails is inside here, I assume at line 171.

https://github.com/edgedb/edgedb-cli/blob/master/src/portable/repository.rs#L169

The rest of the errors are from inside the reqwest crate which is the client making the request, and that's the puzzling part. I guess the tcp error might have to do with the CLI being confused by the duplicate names used before. Maybe I can replicate it though I'm on Windows so tough to say.

Did deleting edgedb.toml solve the issue though?

well1791 commented 10 months ago

Sorry, I forgot to mention that yes I did delete the edgedb.toml file but that didn't help. Also, in regards to the confused by the duplicate names, I deleted all references to edgedb installation before re-installing (I manually deleted the list of files/folders from edgedb info), so, I reinstalled it twice.

Maybe this bit of info helps to identify the source of the bug.

mfenn commented 8 months ago

I also get this issue with edgedb project init and edgedb cli upgrade. With RUST_LOG=TRACE I get

[2023-10-16T20:55:37Z INFO  edgedb::portable::repository] Fetching JSON at https://packages.edgedb.com/archive/.jsonindexes/x86_64-apple-darwin.json
[2023-10-16T20:55:37Z DEBUG reqwest::connect] starting new connection: https://packages.edgedb.com/
edgedb error: failed to fetch JSON at URL: https://packages.edgedb.com/archive/.jsonindexes/x86_64-apple-darwin.json: error sending request for url (https://packages.edgedb.com/archive/.jsonindexes/x86_64-apple-darwin.json): error trying to connect: tcp connect error: Operation not permitted (os error 1): error trying to connect: tcp connect error: Operation not permitted (os error 1): tcp connect error: Operation not permitted (os error 1): Operation not permitted (os error 1)

My EdgeDB CLI version is EdgeDB CLI 3.5.0+d39be05 and I'm on macOS 13.6 x86_64.

I'm typically on a corporate network behind an SSL proxy so that was my initial thought but I get the same error on my home network. (Still on my corporate laptop though so that may have something to do with it.) I have no trouble curling the URL mentioned.

well1791 commented 8 months ago

It's been long since I had this issue, somehow it solved on its own after a week or two (since I opened this issue). I believe it could be something related to some weird cache that eventually wast just dismissed due to the long period.

youngkidwarrior commented 8 months ago

Same error. Restarting my computer fixed it. Probably is some weird cache issue

KatFishSnake commented 1 month ago

Getting this on Mac Sonoma 14.4.1, tried VPN, tried different projects, nothing works but restarting my computer, then it works for a bit then returns to the previous state at some point, can't make sense of this

mmastrac commented 1 week ago

This may be related to device management software (specifically JAMF).

It may be useful to provide traces from the macOS Console application, filtering on edgedb and Errors and Faults. If you are running MDM software on a corporate laptop, providing logs (ie: JAMF) may also be useful.