{"action":"created","issue":{"url":"https://api.github.com/repos/ali-sdk/ali-oss/issues/541","repository_url":"https://api.github.com/repos/ali-sdk/ali-oss","labels_url":"https://api.github.com/repos/ali-sdk/ali-oss/issues/541/labels{/name}","comments_url":"https://api.github.com/repos/ali-sdk/ali-oss/issues/541/comments","events_url":"https://api.github.com/repos/ali-sdk/ali-oss/issues/541/events","html_url":"https://github.com/ali-sdk/ali-oss/issues/541","id":375884827,"node_id":"MDU6SXNzdWUzNzU4ODQ4Mjc=","number":541,"title":"Timeout and socket hang up error on STS token call","user":{"login":"shabbir21","id":10743756,"node_id":"MDQ6VXNlcjEwNzQzNzU2","avatar_url":"https://avatars0.githubusercontent.com/u/10743756?v=4","gravatar_id":"","url":"https://api.github.com/users/shabbir21","html_url":"https://github.com/shabbir21","followers_url":"https://api.github.com/users/shabbir21/followers","following_url":"https://api.github.com/users/shabbir21/following{/other_user}","gists_url":"https://api.github.com/users/shabbir21/gists{/gist_id}","starred_url":"https://api.github.com/users/shabbir21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shabbir21/subscriptions","organizations_url":"https://api.github.com/users/shabbir21/orgs","repos_url":"https://api.github.com/users/shabbir21/repos","events_url":"https://api.github.com/users/shabbir21/events{/privacy}","received_events_url":"https://api.github.com/users/shabbir21/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-31T10:04:46Z","updated_at":"2018-11-16T02:31:45Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nThank you for reporting an issue.\r\n\r\n1. It's RECOMMENDED to submit PR for typo or tiny bug fix.\r\n2. If this's a BUG, please provide: course repetition, network error log and configuration. Fill in as much of the template below as you're able.\r\n3. It will be nice to use example project to provide a mini GitHub repository which can reproduce the issue.\r\n4. please try user newest ali-oss version.\r\n\r\n感谢您向我们反馈问题。\r\n\r\n1. 我们推荐如果是小问题（错别字修改，小的 bug fix）直接提交 PR。\r\n2. 如果是一个 BUG，请提供：复现步骤，错误请求和响应日志以及相关配置，并尽量填写下面的模板中的条目(请网络响应中x-oss-request-id字段值)。\r\n3. 如果可以，请使用项目中 example工程提供一个最小可复现的代码仓库，方便我们排查问题。\r\n4. 尽量使用最新版本的SDK方便我们维护跟踪\r\n5. 扩展阅读：[如何向开源项目提交无法解答的问题](https://zhuanlan.zhihu.com/p/25795393)\r\n-->\r\n\r\n* **Node Version**: 8\r\n* **ali-oss Version**: 6.0.1\r\n\r\n<!-- Enter your issue details below this comment. -->\r\nHi,\r\n\r\nWe have our Node servers hosted on GCP but we are using Alibaba Cloud OSS for our storage needs.\r\nOur android clients communicate with our Node server.\r\n\r\nOur photo upload process to OSS is:\r\n1. Client requests a token from our Node server\r\n2. Our Node server requests Alibaba Cloud for a token to upload the image\r\n3. The token returned by Aliyun is then returned to our client\r\n4. Client then uses that token to upload the image to Aliyun\r\n\r\nPoint# **2** is failing with the following message: ```\"Connect timeout for 60000ms, POST https://sts.aliyuncs.com -2 (connected: false, keepalive socket: false, socketHandledRequests: 1, socketHandledResponses: 0)\r\nheaders: {}\" ```\r\n\r\n* **Mini Showcase Repository**:\r\nOur code is:\r\n```\r\nconst OSS = require('ali-oss');\r\nconst STS = OSS.STS;\r\napp.get('/cloud/ststoken', passport.ensureAuthenticated, async (req, res, next) => {\r\n  try {\r\n  const sts = new STS({\r\n    accessKeyId: '*************',\r\n    accessKeySecret: '******************************',\r\n  });\r\n\r\n    const roleArn = 'acs:ram::1234567899888:role/mobileappuploadimage';\r\n    const expiryDuration = 15 * 60;\r\n\r\n    let val = await sts.assumeRole(roleArn, null, expiryDuration, 'app');\r\n    res.data = val.credentials;\r\n    next();\r\n  } catch (err) {\r\n    next(errors.EXTERNAL_SERVER_RESPOND_WITH_ERROR({ info: { code: err.code, message: err.message } }));\r\n  }\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/ali-sdk/ali-oss/issues/comments/439261251","html_url":"https://github.com/ali-sdk/ali-oss/issues/541#issuecomment-439261251","issue_url":"https://api.github.com/repos/ali-sdk/ali-oss/issues/541","id":439261251,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTI2MTI1MQ==","user":{"login":"luozhang002","id":5653578,"node_id":"MDQ6VXNlcjU2NTM1Nzg=","avatar_url":"https://avatars0.githubusercontent.com/u/5653578?v=4","gravatar_id":"","url":"https://api.github.com/users/luozhang002","html_url":"https://github.com/luozhang002","followers_url":"https://api.github.com/users/luozhang002/followers","following_url":"https://api.github.com/users/luozhang002/following{/other_user}","gists_url":"https://api.github.com/users/luozhang002/gists{/gist_id}","starred_url":"https://api.github.com/users/luozhang002/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luozhang002/subscriptions","organizations_url":"https://api.github.com/users/luozhang002/orgs","repos_url":"https://api.github.com/users/luozhang002/repos","events_url":"https://api.github.com/users/luozhang002/events{/privacy}","received_events_url":"https://api.github.com/users/luozhang002/received_events","type":"User","site_admin":false},"created_at":"2018-11-16T02:31:45Z","updated_at":"2018-11-16T02:31:45Z","author_association":"COLLABORATOR","body":"@shabbir21  -2 网络问题，先确保你本地网络环境。"}}
{"actor":{"display_login":"luozhang002"}}