mantil-io / mantil

Build your AWS Lambda-based Go backends quicker than ever
https://www.mantil.com
MIT License
110 stars 3 forks source link

setup sometimes fails with 'concurrent modification' error #29

Closed ianic closed 2 years ago

ianic commented 2 years ago
λ Error: error creating API Gateway v2 route: ConflictException: Unable to complete operation due to concurrent modification. Please try again later.
λ   with module.api.aws_apigatewayv2_route.http_proxy["/data/POST"],
λ   on .terraform/modules/api/http.tf line 32, in resource "aws_apigatewayv2_route" "http_proxy":
λ   32: resource "aws_apigatewayv2_route" "http_proxy" {
λ >> terraform apply -no-color -input=false tfplan
λ FAILED with exit status 1
djelusic commented 2 years ago

There was a similar issue for api gateway v1 which was fixed. I couldn't find anything similar for v2 so I'm not sure if this is also a terraform bug or something on our end.

ianic commented 2 years ago

Dobio sam ga da nastavi. Nezgodno je sto dio s error-om bude u crveno. I na kraju napise samo resurse koje je naknadno kreirao (3 added), ali izvucemo se.


Creating setup function...
Deploying backend infrastructure...
λ Created api.aws_apigatewayv2_api.http in 0s
λ Created api.aws_apigatewayv2_api.ws in 0s
λ Created api.aws_iam_role.ws_handler in 1s
λ Created api.aws_iam_role.authorizer[0] in 1s
λ Created api.aws_iam_role.sqs_forwarder in 1s
λ Created funcs.aws_iam_role.lambda in 1s
λ Created api.aws_iam_role_policy.ws_handler in 1s
λ Created api.aws_iam_role_policy.authorizer[0] in 1s
λ Created funcs.aws_iam_role_policy.lambda in 1s
λ Created api.aws_iam_role_policy.sqs_forwarder in 1s
λ Created funcs.aws_iam_instance_profile.lambda in 1s
λ Created api.aws_dynamodb_table.table in 6s
λ Created iam.aws_iam_role.cli_user in 6s
λ Created iam.aws_iam_role_policy.cli_user in 1s
λ Created api.aws_lambda_function.ws_handler in 14s
λ Created api.aws_lambda_function.authorizer[0] in 14s
λ Created api.aws_lambda_permission.authorizer_ws_api_gateway_invoke[0] in 0s
λ Created api.aws_apigatewayv2_integration.ws_handler in 0s
λ Created api.aws_lambda_permission.authorizer_http_api_gateway_invoke[0] in 0s
λ Created funcs.aws_lambda_function.functions["data"] in 14s
λ Created api.aws_lambda_function.sqs_forwarder in 14s
λ Created api.aws_apigatewayv2_authorizer.http[0] in 0s
λ Created api.aws_apigatewayv2_route.ws_handler["$default"] in 0s
λ Created api.aws_apigatewayv2_route.ws_handler["$disconnect"] in 0s
λ Created api.aws_apigatewayv2_authorizer.ws[0] in 0s
λ Created api.aws_sqs_queue.queue in 1s
λ Created api.aws_lambda_permission.ws_handler_api_gateway_invoke in 16s
λ Created api.aws_apigatewayv2_route.ws_handler_connect in 0s
λ Created api.aws_apigatewayv2_deployment.ws in 1s
λ Created funcs.aws_lambda_function.functions["security"] in 14s
λ Created api.aws_apigatewayv2_stage.ws_default in 1s
λ Created funcs.aws_lambda_function.functions["deploy"] in 19s
λ Created funcs.aws_lambda_function.functions["destroy"] in 21s
λ Created api.aws_lambda_permission.api_gateway_invoke["/security/POST"] in 0s
λ Created api.aws_lambda_permission.api_gateway_invoke["/destroy/POST"] in 1s
λ Created api.aws_apigatewayv2_integration.http["/deploy/POST"] in 1s
λ Created api.aws_apigatewayv2_integration.http_proxy["/security/POST"] in 1s
λ Created api.aws_apigatewayv2_integration.http["/security/POST"] in 1s
λ Created api.aws_apigatewayv2_integration.http["/data/POST"] in 1s
λ Created api.aws_lambda_permission.api_gateway_invoke["/data/POST"] in 0s
λ Created api.aws_apigatewayv2_integration.http_proxy["/deploy/POST"] in 1s
λ Created api.aws_apigatewayv2_integration.http_proxy["/data/POST"] in 1s
λ Created api.aws_lambda_permission.api_gateway_invoke["/deploy/POST"] in 0s
λ Created api.aws_apigatewayv2_integration.http["/destroy/POST"] in 1s
λ Created api.aws_apigatewayv2_integration.http_proxy["/destroy/POST"] in 1s
λ Created api.aws_apigatewayv2_route.http["/data/POST"] in 0s
λ Created api.aws_apigatewayv2_route.http_proxy["/data/POST"] in 0s
λ Created api.aws_apigatewayv2_route.http["/deploy/POST"] in 0s
λ Created api.aws_apigatewayv2_route.http_proxy["/security/POST"] in 0s
λ Created api.aws_apigatewayv2_route.http_proxy["/deploy/POST"] in 0s
λ Created api.aws_apigatewayv2_route.http["/security/POST"] in 0s
λ Created api.aws_apigatewayv2_route.http_proxy["/destroy/POST"] in 2s
λ Created api.aws_lambda_event_source_mapping.handler_trigger in 14s
λ Error: error creating API Gateway v2 route: ConflictException: Unable to complete operation due to concurrent modification. Please try again later.
λ   with module.api.aws_apigatewayv2_route.http["/destroy/POST"],
λ   on ../../modules/api/http.tf line 15, in resource "aws_apigatewayv2_route" "http":
λ   15: resource "aws_apigatewayv2_route" "http" {
λ >> terraform apply -no-color -input=false tfplan
λ FAILED with exit status 1
λ Created api.aws_apigatewayv2_route.http["/destroy/POST"] in 0s
λ Created api.aws_apigatewayv2_deployment.http in 1s
λ Created api.aws_apigatewayv2_stage.http_default in 0s
λ Resources: 3 added, 0 changed, 0 destroyed
setup successfully finished```
IvanVlasic commented 2 years ago

Svakako se trebamo potruditi otkriti pravi uzrok i rijesiti to. Ovo je korisno da setup ne padne, ali nije bas optimalno iskustvo za korisnika. Posvetim se i ja malo tome ovih dana.