简体   繁体   中英

EntityAlreadyExists: Role with name chatbot-andrea-executor already exists

I am creating a Nodebot with claudiajs.

const botBuilder = require('claudia-bot-builder')
const excuse     = require('huh')

module.exports = botBuilder((req) => {
    return `Thanks for sending ${req.text}. Your message is very important to us, but ${excuse.get()}`
}) 

but when I am deploying to aws cloud.

claudia create --region us-east-1 --api-module app

I am getting this error:

{ EntityAlreadyExists: Role with name chatbot-andrea-executor already exists.
    at Request.extractError (/.nvm/versions/node/v6.10.3/lib/node_modules/claudia/node_modules/aws-sdk/lib/protocol/query.js:47:29)
    at Request.callListeners (/.nvm/versions/node/v6.10.3/lib/node_modules/claudia/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at Request.emit (/.nvm/versions/node/v6.10.3/lib/node_modules/claudia/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/.nvm/versions/node/v6.10.3/lib/node_modules/claudia/node_modules/aws-sdk/lib/request.js:678:14)
    at Request.transition (/.nvm/versions/node/v6.10.3/lib/node_modules/claudia/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/.nvm/versions/node/v6.10.3/lib/node_modules/claudia/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /.nvm/versions/node/v6.10.3/lib/node_modules/claudia/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/.nvm/versions/node/v6.10.3/lib/node_modules/claudia/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/.nvm/versions/node/v6.10.3/lib/node_modules/claudia/node_modules/aws-sdk/lib/request.js:680:12)
    at Request.callListeners (/.nvm/versions/node/v6.10.3/lib/node_modules/claudia/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
  message: 'Role with name chatbot-andrea-executor already exists.',
  code: 'EntityAlreadyExists',
  time: 2017-05-19T19:03:01.956Z,
  requestId: '-requestId (I changed it)-',
  statusCode: 409,
  retryable: false,
  retryDelay: 4.143280988568199 }

As it is very clever, there is a role in aws that has the same name. So, you can try to change the name of the role in your code but how we are using a prebuilt Nodebot solution we have not too much choices. So, delete the role is the answer.

  1. go to IAM management console
  2. Delete the role

在此处输入图片说明

You can find more info about this name collision, here .

For me, the issue was the app was already deployed to aws lambda and I already have a facebook bot.

I wanted to create a telegram bot and that's why the issue happened.

Then, I used update rather than create like:

claudia update --region us-central-1 --api-module bot --configure-telegram-bot

and it worked for me,

I just find that even (if you need to) you can set the role in the deployment command:

claudia create --region us-east-1 --role chatbot-andrea-executor  --api-module app

You have to replace the name on collision after --role 's flag. Also you are more curios about here is a good starting point about custom deployments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM