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

neard init fail #7121

Closed
llifezou opened this issue Jun 27, 2022 · 1 comment
Closed

neard init fail #7121

llifezou opened this issue Jun 27, 2022 · 1 comment

Comments

@llifezou
Copy link

llifezou commented Jun 27, 2022

Describe the bug
init node fail

To Reproduce
neard --home /data/ init --chain-id miannet --download-genesis --download-config

Expected behavior
init success

Version (please complete the following information):
neard (release 1.27.0) (build crates-0.13.0-20-gac2a43e26) (rustc 1.60.0) (protocol 54) (db 31)

Additional context

neard --home /data/ init --chain-id miannet --download-genesis --download-config
2022-06-27T09:55:17.694827Z  INFO neard: version="1.27.0" build="crates-0.13.0-20-gac2a43e26" latest_protocol=54
2022-06-27T09:55:17.694866Z  INFO near: Downloading config file from: https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/miannet/config.json ...
  [00:00:00] 16.00EB [23.84MB/s]
2022-06-27T09:55:18.452916Z  INFO near: Saved the config file to: /data/config.json ...
2022-06-27T09:55:18.452966Z ERROR neard::cli: Failed to initialize configs: Failed to deserialize config from /data/config.json: expected value at line 1 column 1

Downloading config file from: https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/miannet/config.json url is wrong

 wget https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/config.json
--2022-06-27 17:57:24--  https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/mainnet/config.json
Resolving s3-us-west-1.amazonaws.com (s3-us-west-1.amazonaws.com)... 52.219.112.112
Connecting to s3-us-west-1.amazonaws.com (s3-us-west-1.amazonaws.com)|52.219.112.112|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3654 (3.6K) [application/json]
Saving to: ‘config.json.2’

config.json.2                                          100%[===========================================================================================================================>]   3.57K  --.-KB/s    in 0s

2022-06-27 17:57:25 (86.3 MB/s) - ‘config.json.2’ saved [3654/3654]

wget https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/miannet/config.json
--2022-06-27 17:58:46--  https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/miannet/config.json
Resolving s3-us-west-1.amazonaws.com (s3-us-west-1.amazonaws.com)... 52.219.117.144
Connecting to s3-us-west-1.amazonaws.com (s3-us-west-1.amazonaws.com)|52.219.117.144|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2022-06-27 17:58:48 ERROR 403: Forbidden.
@mina86
Copy link
Contributor

mina86 commented Jun 27, 2022

--chain-id miannet – you’ve typed ‘mainnet’ incorrectly

@mina86 mina86 closed this as completed Jun 27, 2022
github-merge-queue bot pushed a commit that referenced this issue Jun 3, 2024
Hyper is not opinionated enough to care about connection StatusCode.
In case of errors such as AccessDenied, return code 403, it will still
download the return body and not raise any errors (see
#7121).
status_code.is_success checks if status is within 200-299.

```
nearcore/target/debug/neard --home ".near" init --chain-id inexistent_network --download-genesis --download-config
2024-06-01T18:23:34.118646Z  INFO neard: version="trunk" build="1.36.1-671-g99a05c482" latest_protocol=67
2024-06-01T18:23:34.121032Z  INFO near: Downloading config file from: https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/inexistent_network/config.json ...
Error: Failed to initialize configs

Caused by:
    0: Failed to download the config file from https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore-deploy/inexistent_network/config.json
    1: Unsuccessful HTTP connection. Return code: 403 Forbidden
```

Unit test to make sure non successful codes are handled:
```
cargo test --package nearcore --lib download_file::tests::test_file_download_bad_http_code
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.33s
warning: the following packages contain code that will be rejected by a future version of Rust: fs_extra v1.2.0, wasmparser v0.78.2
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 52`
     Running unittests src/lib.rs (target/debug/deps/nearcore-9131a198eca62608)

running 1 test
test download_file::tests::test_file_download_bad_http_code ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 24 filtered out; finished in 0.00s
```
#7122
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

No branches or pull requests

2 participants