aws-solutions-library-samples/guidance-for-modernizing-electric-vehicle-charging-on-aws

CreateKeysAndCertificate fails when deploying

Closed this issue · 1 comments

kamami commented

I followed the documentation to deploy the stack to this point:

image

Here it keeps failing with this error:

15:27:55 | CREATE_FAILED        | Custom::AWS                                 | CreateKeysAndCertificate4D276FB5
Response object is too long.

15:28:02 | DELETE_FAILED        | Custom::AWS                                 | CreateKeysAndCertificate4D276FB5
Received response status [FAILED] from custom resource. Message returned: 2 validation errors detected: Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certifi
cateId' failed to satisfy constraint: Member must satisfy regular expression pattern: (0x)?[a-fA-F0-9]+; Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certif
icateId' failed to satisfy constraint: Member must have length less than or equal to 64 (RequestId: 083d3d06-5e9a-420a-9f49-abd4f86d192e)


 ❌  AwsOcppGatewayStack failed: Error: The stack named AwsOcppGatewayStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_FAILED (The following resource(s) failed to delete: [CreateKeysAndCertificate4D276FB5]. ): Response object is too long., Received response status [FAILED] from custom resource. Message returned: 2 validation errors detected: Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must satisfy regular expression pattern: (0x)?[a-fA-F0-9]+; Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must have length less than or equal to 64 (RequestId: 083d3d06-5e9a-420a-9f49-abd4f86d192e)
    at FullCloudFormationDeployment.monitorDeployment (/Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:380:10236)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async deployStack2 (/Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:383:145458)
    at async /Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:383:128776
    at async run (/Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:383:126782)

 ❌ Deployment failed: Error: Stack Deployments Failed: Error: The stack named AwsOcppGatewayStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_FAILED (The following resource(s) failed to delete: [CreateKeysAndCertificate4D276FB5]. ): Response object is too long., Received response status [FAILED] from custom resource. Message returned: 2 validation errors detected: Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must satisfy regular expression pattern: (0x)?[a-fA-F0-9]+; Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must have length less than or equal to 64 (RequestId: 083d3d06-5e9a-420a-9f49-abd4f86d192e)
    at deployStacks (/Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:383:129083)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async CdkToolkit.deploy (/Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:383:147507)
    at async exec4 (/Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:438:51799)

Stack Deployments Failed: Error: The stack named AwsOcppGatewayStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_FAILED (The following resource(s) failed to delete: [CreateKeysAndCertificate4D276FB5]. ): Response object is too long., Received response status [FAILED] from custom resource. Message returned: 2 validation errors detected: Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must satisfy regular expression pattern: (0x)?[a-fA-F0-9]+; Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must have length less than or equal to 64 (RequestId: 083d3d06-5e9a-420a-9f49-abd4f86d192e)

Any idea what I am doing wrong? All steps (incl. bootstrapping) before worked out fine.
I am trying to deploy to eu-central-1 btw.

Hi @kamami

Bad luck, it looks like the random generated certificate ID (AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY) is 65 characters long while the service limit is 64.

You should quickly get unblocked by reducing the length of stack name string 'AwsOcppGatewayStack' https://github.com/aws-samples/aws-ocpp-gateway/blob/921ee8228ae54ac8dcdd3f253b2c29200e02773d/bin/aws-ocpp-gateway.ts#L8 or the resource name string 'CreateKeysAndCertificate' https://github.com/aws-samples/aws-ocpp-gateway/blob/921ee8228ae54ac8dcdd3f253b2c29200e02773d/lib/aws-ocpp-gateway-stack.ts#L198

to shorter strings, i.e. try to call it KeysAndCers for example.

Will push a version with shorter resource name but in the meantime you can try that