VeriorPies / MineCloud

An AWS CDK project to set up an almost free on-demand multiplayer server (Minecraft, Terraria, and more...) for a Discord community in just a few minutes
MIT License
290 stars 14 forks source link

Installation Trouble #46

Closed avidant closed 1 year ago

avidant commented 1 year ago

I tried deploying with a brand new AWS account.

I do have multiple AWS account credentials on my laptop so I used the correct profile (passing the --profile) tag

Pre requisites

USER@xxx-MacBook-Pro MineCloud-1.1.0 % node --version
v18.4.0
USER@xxx-MacBook-Pro MineCloud-1.1.0 % aws --version
aws-cli/2.7.9 Python/3.9.13 Darwin/20.5.0 source/x86_64 prompt/off

Terminal Log

xxx@xxx-MacBook-Pro MineCloud-1.1.0 % npx cdk deploy --profile minecraft-discord
Bundling asset MineCloud/MineCloud_discord_commands_register_lambda/Code/Stage...

  cdk.out/bundling-temp-4e685f68940a765a4ed4847d4d773ddf7e2d7dfb3afa6065170b3443da43b77d/index.js  370.3kb

⚡ Done in 22ms
Bundling asset MineCloud/MineCloud_discord_interactions_endpoint_construct/MineCloud_discord_interactions_endpoint_lambda/Code/Stage...

  cdk.out/bundling-temp-6626f17e65c370d5c0f9f5f0aac55e2ce76f0fb27a8fa4ff20c2220cf3e6ca2c/index.js  18.7mb ⚠️

⚡ Done in 152ms
Bundling asset MineCloud/MineCloud_discord_interactions_endpoint_construct/MineCloud_discord_command_processor_lambda/Code/Stage...

  cdk.out/bundling-temp-a4eb7f2edfaee3b0511d1ca7be7999344e11db9698f37ce9f2759340055524ce/index.js  19.0mb ⚠️

⚡ Done in 199ms

✨  Synthesis time: 7.45s

MineCloud: building assets...

[0%] start: Building 97817db928c43d4646fed3437ff70ca3fe8d1ca5d5538e80726641d669c244fd:<AWS_ACC_ID>-ap-south-1
[0%] start: Building 0e22f72895a5bd555e2ce81d5dc6b7d01ac1835cd925dd80276ba2dad75c13fb:<AWS_ACC_ID>-ap-south-1
[0%] start: Building 903be65b9594a9f17d7120273620367e7830b6d087fc9591f31dc5a080049e46:<AWS_ACC_ID>-ap-south-1
[0%] start: Building 2b36d5d4dcb60993ddf36ecf68feed35ecbc70c3b92dcd77638a2c876866ad88:<AWS_ACC_ID>-ap-south-1
[0%] start: Building 85bb78ae8c7c9ad2d7d8a193f0ee234de6d82fdfba52da88120ea46ad54feea4:<AWS_ACC_ID>-ap-south-1
[0%] start: Building e30e6151fa91fad623f41b3e17ed2885697fde9fd59c95edbad26c7ec837a58a:<AWS_ACC_ID>-ap-south-1
[16%] success: Built 97817db928c43d4646fed3437ff70ca3fe8d1ca5d5538e80726641d669c244fd:<AWS_ACC_ID>-ap-south-1
[33%] success: Built 0e22f72895a5bd555e2ce81d5dc6b7d01ac1835cd925dd80276ba2dad75c13fb:<AWS_ACC_ID>-ap-south-1
[50%] success: Built 903be65b9594a9f17d7120273620367e7830b6d087fc9591f31dc5a080049e46:<AWS_ACC_ID>-ap-south-1
[66%] success: Built 2b36d5d4dcb60993ddf36ecf68feed35ecbc70c3b92dcd77638a2c876866ad88:<AWS_ACC_ID>-ap-south-1
[83%] success: Built 85bb78ae8c7c9ad2d7d8a193f0ee234de6d82fdfba52da88120ea46ad54feea4:<AWS_ACC_ID>-ap-south-1
[100%] success: Built e30e6151fa91fad623f41b3e17ed2885697fde9fd59c95edbad26c7ec837a58a:<AWS_ACC_ID>-ap-south-1

MineCloud: assets built

MineCloud: deploying... [1/1]
[0%] start: Publishing 97817db928c43d4646fed3437ff70ca3fe8d1ca5d5538e80726641d669c244fd:<AWS_ACC_ID>-ap-south-1
[0%] start: Publishing 0e22f72895a5bd555e2ce81d5dc6b7d01ac1835cd925dd80276ba2dad75c13fb:<AWS_ACC_ID>-ap-south-1
[0%] start: Publishing 903be65b9594a9f17d7120273620367e7830b6d087fc9591f31dc5a080049e46:<AWS_ACC_ID>-ap-south-1
[0%] start: Publishing 2b36d5d4dcb60993ddf36ecf68feed35ecbc70c3b92dcd77638a2c876866ad88:<AWS_ACC_ID>-ap-south-1
[0%] start: Publishing 85bb78ae8c7c9ad2d7d8a193f0ee234de6d82fdfba52da88120ea46ad54feea4:<AWS_ACC_ID>-ap-south-1
[0%] start: Publishing e30e6151fa91fad623f41b3e17ed2885697fde9fd59c95edbad26c7ec837a58a:<AWS_ACC_ID>-ap-south-1
[16%] success: Published 85bb78ae8c7c9ad2d7d8a193f0ee234de6d82fdfba52da88120ea46ad54feea4:<AWS_ACC_ID>-ap-south-1
[33%] success: Published 2b36d5d4dcb60993ddf36ecf68feed35ecbc70c3b92dcd77638a2c876866ad88:<AWS_ACC_ID>-ap-south-1
[50%] success: Published 97817db928c43d4646fed3437ff70ca3fe8d1ca5d5538e80726641d669c244fd:<AWS_ACC_ID>-ap-south-1
[66%] success: Published 0e22f72895a5bd555e2ce81d5dc6b7d01ac1835cd925dd80276ba2dad75c13fb:<AWS_ACC_ID>-ap-south-1
[83%] success: Published 903be65b9594a9f17d7120273620367e7830b6d087fc9591f31dc5a080049e46:<AWS_ACC_ID>-ap-south-1
[100%] success: Published e30e6151fa91fad623f41b3e17ed2885697fde9fd59c95edbad26c7ec837a58a:<AWS_ACC_ID>-ap-south-1
MineCloud: creating CloudFormation changeset...
4:08:05 PM | CREATE_FAILED        | AWS::CloudFormation::CustomResource | MineClouddiscordcommandsregisterresource
Received response status [FAILED] from custom resource. Message returned: Error: 2023-05-07T10:38:04.485Z c0c2fd89-6da0-4857-a322-43bba04d23b8 Task timed out after 3.01 seconds

Logs: /aws/lambda/MineCloud-MineClouddiscordcommandsregisterlambda95-n8pTPd6Hw3t2

at invokeUserFunction (/var/task/framework.js:2:6)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async onEvent (/var/task/framework.js:1:369)
at async Runtime.handler (/var/task/cfn-response.js:1:1573) (RequestId: cad00625-ab3f-4c88-b864-ee8ec4fd5dc5)

 ❌  MineCloud failed: Error: The stack named MineCloud failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Received response status [FAILED] from custom resource. Message returned: Error: 2023-05-07T10:38:04.485Z c0c2fd89-6da0-4857-a322-43bba04d23b8 Task timed out after 3.01 seconds

Logs: /aws/lambda/MineCloud-MineClouddiscordcommandsregisterlambda95-n8pTPd6Hw3t2

    at invokeUserFunction (/var/task/framework.js:2:6)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async onEvent (/var/task/framework.js:1:369)
    at async Runtime.handler (/var/task/cfn-response.js:1:1573) (RequestId: cad00625-ab3f-4c88-b864-ee8ec4fd5dc5)
    at FullCloudFormationDeployment.monitorDeployment (/Users/USER/Downloads/MineCloud-1.1.0/node_modules/aws-cdk/lib/index.js:380:10236)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async deployStack2 (/Users/USER/Downloads/MineCloud-1.1.0/node_modules/aws-cdk/lib/index.js:383:145458)
    at async /Users/USER/Downloads/MineCloud-1.1.0/node_modules/aws-cdk/lib/index.js:383:128776
    at async run (/Users/USER/Downloads/MineCloud-1.1.0/node_modules/aws-cdk/lib/index.js:383:126782)

 ❌ Deployment failed: Error: Stack Deployments Failed: Error: The stack named MineCloud failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Received response status [FAILED] from custom resource. Message returned: Error: 2023-05-07T10:38:04.485Z c0c2fd89-6da0-4857-a322-43bba04d23b8 Task timed out after 3.01 seconds

Logs: /aws/lambda/MineCloud-MineClouddiscordcommandsregisterlambda95-n8pTPd6Hw3t2

    at invokeUserFunction (/var/task/framework.js:2:6)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async onEvent (/var/task/framework.js:1:369)
    at async Runtime.handler (/var/task/cfn-response.js:1:1573) (RequestId: cad00625-ab3f-4c88-b864-ee8ec4fd5dc5)
    at deployStacks (/Users/USER/Downloads/MineCloud-1.1.0/node_modules/aws-cdk/lib/index.js:383:129083)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async CdkToolkit.deploy (/Users/USER/Downloads/MineCloud-1.1.0/node_modules/aws-cdk/lib/index.js:383:147507)
    at async exec4 (/Users/USER/Downloads/MineCloud-1.1.0/node_modules/aws-cdk/lib/index.js:438:51799)

Stack Deployments Failed: Error: The stack named MineCloud failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Received response status [FAILED] from custom resource. Message returned: Error: 2023-05-07T10:38:04.485Z c0c2fd89-6da0-4857-a322-43bba04d23b8 Task timed out after 3.01 seconds

Logs: /aws/lambda/MineCloud-MineClouddiscordcommandsregisterlambda95-n8pTPd6Hw3t2

    at invokeUserFunction (/var/task/framework.js:2:6)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async onEvent (/var/task/framework.js:1:369)
    at async Runtime.handler (/var/task/cfn-response.js:1:1573) (RequestId: cad00625-ab3f-4c88-b864-ee8ec4fd5dc5)
$ % 

AWS CloudFormation

Timestamp Logical ID Status Status reason
2023-05-07 16:08:06 UTC+0530 MineCloud ROLLBACK_IN_PROGRESS The following resource(s) failed to create [MineClouddiscordcommandsregisterresource, MineCloudec2instanceInstanceProfile7C956219]. Rollback requested by user.
2023-05-07 16:08:06 UTC+0530 MineCloudec2instanceInstanceProfile7C956219 CREATE_FAILED Resource creation cancelled
2023-05-07 16:08:05 UTC+0530 MineClouddiscordcommandsregisterresource CREATE_FAILED Received response status [FAILED] from custom resource. Message returned: Error: 2023-05-07T10:38:04.485Z c0c2fd89-6da0-4857-a322-43bba04d23b8 Task timed out after 3.01 seconds Logs: /aws/lambda/MineCloud-MineClouddiscordcommandsregisterlambda95-n8pTPd6Hw3t2 at invokeUserFunction (/var/task/framework.js:2:6) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async onEvent (/var/task/framework.js:1:369) at async Runtime.handler (/var/task/cfn-response.js:1:1573) (RequestId: cad00625-ab3f-4c88-b864-ee8ec4fd5dc5)
314pies commented 1 year ago

Hi avidant,
It looks like the Discord commands register lambda failed - which could be caused by invalid Discord App ID or Discord BOT token.
What did the Discord commands registration lambda's error log said?

avidant commented 1 year ago

The lambda's error log simply says that it timed out. Below is the error log in case I missed something

timestamp,message
1683455881272,"INIT_START Runtime Version: nodejs:18.v6 Runtime Version ARN: arn:aws:lambda:ap-south-1::runtime:a19cefba18c0aa228bfe71e81d95cc5aab18e4570e899b3cfd9f759f022c7f8c
"
1683455881480,"START RequestId: c0c2fd89-6da0-4857-a322-??? Version: $LATEST
"
1683455881503,"2023-05-07T10:38:01.503Z c0c2fd89-6da0-4857-a322-??? INFO    register request:  {
  method: 'post',
  url: 'https://discord.com/api/v10/applications/xxx/commands',
  headers: {
    Authorization: 'Bot xxx'
  },
  data: { name: 'mc_start', type: 1, description: 'Start the server' }
}
"
1683455882904,"2023-05-07T10:38:02.904Z c0c2fd89-6da0-4857-a322-??? INFO    register response:  {
  id: 'xxx',
  application_id: 'xxx',
  version: 'xxx',
  default_member_permissions: null,
  type: 1,
  name: 'mc_start',
  name_localizations: null,
  description: 'Start the server',
  description_localizations: null,
  dm_permission: true,
  contexts: null,
  nsfw: false
}
"
1683455882905,"2023-05-07T10:38:02.905Z c0c2fd89-6da0-4857-a322-??? INFO    register request:  {
  method: 'post',
  url: 'https://discord.com/api/v10/applications/xxx/commands',
  headers: {
    Authorization: 'Bot xxx'
  },
  data: { name: 'mc_stop', type: 1, description: 'Stop the server' }
}
"
1683455883388,"2023-05-07T10:38:03.388Z c0c2fd89-6da0-4857-a322-??? INFO    register response:  {
  id: 'xxx',
  application_id: 'xxx',
  version: 'xxx',
  default_member_permissions: null,
  type: 1,
  name: 'mc_stop',
  name_localizations: null,
  description: 'Stop the server',
  description_localizations: null,
  dm_permission: true,
  contexts: null,
  nsfw: false
}
"
1683455883388,"2023-05-07T10:38:03.388Z c0c2fd89-6da0-4857-a322-??? INFO    register request:  {
  method: 'post',
  url: 'https://discord.com/api/v10/applications/xxx/commands',
  headers: {
    Authorization: 'Bot xxx'
  },
  data: {
    name: 'mc_restart',
    type: 1,
    description: 'Restart the server system service'
  }
}
"
1683455883846,"2023-05-07T10:38:03.846Z c0c2fd89-6da0-4857-a322-??? INFO    register response:  {
  id: 'xxx',
  application_id: 'xxx',
  version: 'xxx',
  default_member_permissions: null,
  type: 1,
  name: 'mc_restart',
  name_localizations: null,
  description: 'Restart the server system service',
  description_localizations: null,
  dm_permission: true,
  contexts: null,
  nsfw: false
}
"
1683455883846,"2023-05-07T10:38:03.846Z c0c2fd89-6da0-4857-a322-??? INFO    register request:  {
  method: 'post',
  url: 'https://discord.com/api/v10/applications/xxx/commands',
  headers: {
    Authorization: 'Bot xxx'
  },
  data: {
    name: 'mc_backup',
    type: 1,
    description: 'Stop the server and make a backup'
  }
}
"
1683455884323,"2023-05-07T10:38:04.323Z c0c2fd89-6da0-4857-a322-??? INFO    register response:  {
  id: 'xxx',
  application_id: 'xxx',
  version: 'xxx',
  default_member_permissions: null,
  type: 1,
  name: 'mc_backup',
  name_localizations: null,
  description: 'Stop the server and make a backup',
  description_localizations: null,
  dm_permission: true,
  contexts: null,
  nsfw: false
}
"
1683455884324,"2023-05-07T10:38:04.324Z c0c2fd89-6da0-4857-a322-??? INFO    register request:  {
  method: 'post',
  url: 'https://discord.com/api/v10/applications/xxx/commands',
  headers: {
    Authorization: 'Bot xxx'
  },
  data: {
    name: 'mc_backup_download',
    type: 1,
    description: 'Get the latest backup'
  }
}
"
1683455884486,"2023-05-07T10:38:04.485Z c0c2fd89-6da0-4857-a322-??? Task timed out after 3.01 seconds

"
1683455884486,"END RequestId: c0c2fd89-6da0-4857-a322-???
"
1683455884486,"REPORT RequestId: c0c2fd89-6da0-4857-a322-???    Duration: 3005.90 ms    Billed Duration: 3000 ms    Memory Size: 128 MB Max Memory Used: 82 MB  Init Duration: 207.39 ms    
"
1683455884567,"INIT_START Runtime Version: nodejs:18.v6 Runtime Version ARN: arn:aws:lambda:ap-south-1::runtime:a19cefba18c0aa228bfe71e81d95cc5aab18e4570e899b3cfd9f759f022c7f8c
"
314pies commented 1 year ago

This could be it simply timeout:

Can you try to increase the lambda timeout time and try again?

avidant commented 1 year ago

Could you let me know how to do that? I have no experience with CloudFormation

314pies commented 1 year ago

Just update the timeout setting from the lambda settings and use the "Test" button to re-run the lambda.
Don't need to re-deploy I think. image

avidant commented 1 year ago

The function seems to have gotten deleted in the rollback

image
314pies commented 1 year ago

Oh... then we will need to re-deploy it.
Can you add timeout: Duration.seconds(30) to here, run npx cdk list to confirm the build still pass and re-deploy again?

314pies commented 1 year ago

Update:
Discord register lambda time-out duration has been increased to 30 seconds in the 1.2.0 release.

314pies commented 1 year ago

Closing issue as this is likely resolved, but please don't hesitate let me know if there's any update!