Hi , we have API Gateway hooked to a stateMachine. The StateMachine triggers a couple of lambda for our workflow. Wanted to know how to clean up localstack and all its cache files. We have a localStack with serverless cloudformation stack running on Mac and windows. I dont have Localstack Pro yet. I want to have clean redeployment of Localstack as i can see old exception still be thrown from API gateway altough i have reverted these exception in my code . Stale error - botocore.errorfactory.InvalidArn: An error occurred (InvalidArn) when calling the DescribeExecution operation: Invalid Arn: ‘Resource type not valid in this context: express’. I have deleted .serverless and .docker yet i can see stale cache somewhere in localstack after redeployment. On a new machine code works fine.
Kindly let me know how to do a clean redeployment of LocalStack
Hi @piseprashanth,
The easiest way to clear the LocalStack session is to restart (stop/start) LocalStack container and redeploy your resources.
For more details, please have a look at our documentation pages:
LocalStack volume directory
/var/lib/localstack
: the LocalStack volume directory root/var/lib/localstack/lib
: variable packages (like extensions or lazy-loaded third-party dependencies)/var/lib/localstack/logs
: logs for recent LocalStack runs/var/lib/localstack/state
: contains the state of services if persistence is enabled (such as OpenSearch cluster data)/var/lib/localstack/tmp
: temporary data that is not expected to survive LocalStack runs (may be cleared when LocalStack starts or stops)/var/lib/localstack/cache
: temporary data that is expected to survive LocalStack runs (is not cleared when LocalStack starts or stops)
You can use the
/_localstack/health
endpoint to restart or kill the services. You can usecURL
or your HTTP REST client to access the endpoint:$ curl -v --request POST --header "Content-Type: application/json" --data '{"action":"restart"}' http://localhost:4566/_localstack/health $ curl -v --request POST --header "Content-Type: application/json" --data '{"action":"kill"}' http://localhost:4566/_localstack/health
- CloudFormation | Docs (localstack.cloud)
The list of resources that LocalStack CloudFormation support is available on the documentation page.
I tried deleting all the data from /var/lib/localstack but still i get a response {“Type”: “User”, “message”: “Error invoking integration for API Gateway ID ‘2lj619bxfo’: An error occurred (InvalidArn) when calling the DescribeExecution operation: Invalid Arn: ‘Resource type not valid in this context: express’”, "_type": “InvalidRequest”}. At the end of the statemachine it should return response with 200 ok and status body response but i see stale exception response f7b64-691a-4bdd-b111-7738f6f53be3 Duration: 2374.31 ms Billed Duration: 2375 ms Memory Size: 1024 MB Max Memory Used: 1024 MB
2024-07-24 15:43:57 2024-07-24T10:13:57.151 DEBUG — [et.reactor-9] l.s.lambda.provider : Lambda invocation duration: 4509.64ms
2024-07-24 15:43:57 2024-07-24T10:13:57.153 DEBUG — [d-138 (eval)] l.s.s.a.c.eval_component : [ASL] [comp] [ResultPath]: ‘(ResultPath| {‘result_path_src’: ‘$’}’
2024-07-24 15:43:57 2024-07-24T10:13:57.156 DEBUG — [d-138 (eval)] l.s.s.a.c.eval_component : [ASL] [comp] [OutputPath]: ‘(OutputPath| {‘output_path’: ‘$.Payload’}’
2024-07-24 15:44:54 2024-07-24T10:14:54.215 ERROR — [et.reactor-3] l.s.apigateway.invocations : Error invoking integration for API Gateway ID ‘2lj619bxfo’: An error occurred (InvalidArn) when calling the DescribeExecution operation: Invalid Arn: ‘Resource type not valid in this context: express’
2024-07-24 15:44:54 Traceback (most recent call last):
2024-07-24 15:44:54 File “/opt/code/localstack/localstack-core/localstack/services/apigateway/invocations.py”, line 316, in invoke_rest_api_integration
2024-07-24 15:44:54 response = invoke_rest_api_integration_backend(invocation_context)
2024-07-24 15:44:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-24 15:44:54 File “/opt/code/localstack/localstack-core/localstack/services/apigateway/invocations.py”, line 361, in invoke_rest_api_integration_backend
2024-07-24 15:44:54 return StepFunctionIntegration().invoke(invocation_context)
2024-07-24 15:44:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-24 15:44:54 File “/opt/code/localstack/localstack-core/localstack/services/apigateway/integration.py”, line 973, in invoke
2024-07-24 15:44:54 result = await_sfn_execution_result(result[“executionArn”])
2024-07-24 15:44:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-24 15:44:54 File “/opt/code/localstack/localstack-core/localstack/services/stepfunctions/stepfunctions_utils.py”, line 28, in await_sfn_execution_result
2024-07-24 15:44:54 return retry(_get_result, sleep=2, retries=timeout_secs / 2)
2024-07-24 15:44:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-24 15:44:54 File “/opt/code/localstack/localstack-core/localstack/utils/sync.py”, line 63, in retry
2024-07-24 15:44:54 raise raise_error
2024-07-24 15:44:54 File “/opt/code/localstack/localstack-core/localstack/utils/sync.py”, line 59, in retry
2024-07-24 15:44:54 return function(**kwargs)
2024-07-24 15:44:54 ^^^^^^^^^^^^^^^^^^
2024-07-24 15:44:54 File “/opt/code/localstack/localstack-core/localstack/services/stepfunctions/stepfunctions_utils.py”, line 24, in _get_result
2024-07-24 15:44:54 result = client.describe_execution(executionArn=execution_arn)
2024-07-24 15:44:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-24 15:44:54 File “/opt/code/localstack/.venv/lib/python3.11/site-packages/botocore/client.py”, line 565, in _api_call
2024-07-24 15:44:54 return self._make_api_call(operation_name, kwargs)
2024-07-24 15:44:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-24 15:44:54 File “/opt/code/localstack/.venv/lib/python3.11/site-packages/botocore/client.py”, line 1021, in _make_api_call
2024-07-24 15:44:54 raise error_class(parsed_response, operation_name)
2024-07-24 15:44:54 botocore.errorfactory.InvalidArn: An error occurred (InvalidArn) when calling the DescribeExecution operation: Invalid Arn: ‘Resource type not valid in this context: express’
2024-07-24 15:44:54 2024-07-24T10:14:54.218 INFO — [et.reactor-3] localstack.request.http : GET /restapis/2lj619bxfo/local/user_request/collections/{collectionId}/libraries => 400
Please verify if the correct ARN has been provided in your code. Without additional details, it is not possible to offer further assistance as the issue seems to be clearly outlined by the information shared.