遵循以下步骤:
AdministratorAccess
。awsmobile
配置awsmobile configure
,粘贴了上面创建的IAM用户的信用卡。将区域更改为us-east-2
在执行awsmobile init
时,我收到的错误如下所示,其中包含us-east-1
作为区域,但原因如何。
backend awsmobile project creation error
{ NetworkingError: The header content contains invalid characters
at validateHeader (_http_outgoing.js:494:11)
at ClientRequest.setHeader (_http_outgoing.js:498:3)
at new ClientRequest (_http_client.js:173:14)
at Object.request (http.js:38:10)
at Object.request (https.js:239:15)
at features.constructor.handleRequest (C:\Users\manus\AppData\Roaming\npm\node_modules\awsmobile-cli\node_modules\aws-sdk\lib\http\node.js:42:23)
at executeSend (C:\Users\manus\AppData\Roaming\npm\node_modules\awsmobile-cli\node_modules\aws-sdk\lib\event_listeners.js:304:29)
at Request.SEND (C:\Users\manus\AppData\Roaming\npm\node_modules\awsmobile-cli\node_modules\aws-sdk\lib\event_listeners.js:318:9)
at Request.callListeners (C:\Users\manus\AppData\Roaming\npm\node_modules\awsmobile-cli\node_modules\aws-sdk\lib\sequential_executor.js:101:18)
at Request.emit (C:\Users\manus\AppData\Roaming\npm\node_modules\awsmobile-cli\node_modules\aws-sdk\lib\sequential_executor.js:77:10)
message: 'The header content contains invalid characters',
code: 'NetworkingError',
region: 'us-east-1',
hostname: 'mobile.us-east-1.amazonaws.com',
retryable: true,
time: 2018-04-28T15:26:56.753Z
以下是package.json文件:
"dependencies": {
"amazon-cognito-identity-js": "^2.0.3",
"aws-amplify": "^0.3.3",
"aws-amplify-react": "^0.1.43",
"aws-sdk": "^2.228.1",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"react-scripts": "1.1.4"
},
答案 0 :(得分:0)
现在工作正常。
我使用chrome开发工具禁用了防火墙并复制了信用卡,但它确实有效。然后我重新启用防火墙并再次尝试它仍然有效。我认为问题在于我从AWS控制台本身复制了信用卡,但后来我尝试创建一个新用户并从AWS控制台而不是Chrome开发工具进行复制,它也起作用,即现在一切正常。
我还尝试按照https://github.com/aws-samples/aws-mobile-react-sample#getstarted创建一个新项目,但也进展顺利。
所以,我现在无法重新创建它。不确定是什么问题。