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

Proxy環境下でacc loginに失敗する #50

Open
21kazu13 opened this issue Apr 11, 2022 · 1 comment
Open

Proxy環境下でacc loginに失敗する #50

21kazu13 opened this issue Apr 11, 2022 · 1 comment

Comments

@21kazu13
Copy link

21kazu13 commented Apr 11, 2022

素晴らしいツールの開発・メンテナンスありがとうございます。
本格的にatcoderがんばろうと、数ヶ月前に使い始めて便利に利用させていただいております。

普段と異なるネットワーク環境で利用の際、acc loginができなくなることがありました。
具体的には
http_proxyとhttps_proxyにはhttp://{username}:password}@{address}:portが設定されており、
curlで https://atcoder.jp/ に正常に接続できる状態で、acc loginを行ったところ下記のエラーとなりました。

(node:18257) UnhandledPromiseRejectionWarning: Error: Request failed with status code 301
    at createError (/usr/lib/node_modules/atcoder-cli/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/usr/lib/node_modules/atcoder-cli/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/usr/lib/node_modules/atcoder-cli/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (events.js:412:35)
    at endReadableNT (internal/streams/readable.js:1334:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:18257) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:18257) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

何か他の環境変数を設定して渡してあげなければならないなどありますでしょうか?
初めてIssuesを起票しましたので、適切でない点があれば合わせてご教授いただけますと幸いです。

@Tatamo
Copy link
Owner

Tatamo commented Apr 18, 2022

atcoder-cli を使っていただいてありがとうございます。
プロキシを利用した環境にはあまり詳しくなかったのですが、 https://stackoverflow.com/questions/18586902/node-js-global-proxy-setting を見る限りでは node.js は環境変数を利用してプロキシを通してくれるような機能を持っていないようですね……
おそらくこの問題に対応するには atcoder-cli のコード内に変更を入れないといけないので、時間がとれそうなら手元でプロキシを通す環境を整えて調査してみます。
(メモ: https://www.npmjs.com/package/global-agent )

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