While a lambda is still processing (archive unpacking etc), the lambda state should be set to "Pending" (currently "Active") and invocations to that lambda should fail (currently, it can end up in a inconsistent state in this case, like lambdas being executed without layers).

Lambda state should reflect the current internal state, and invocations should fail if not active.
)
    def test_invoke_nodejs_lambda_with_payload_containing_quotes(
        self, lambda_client, create_lambda_function, runtime, logs_client, snapshot
    ):
        """Test nodejs invocation of payload with quotes"""
        snapshot.add_transformer(snapshot.transform.lambda_api())
        function_name = f"test_lambda_{short_uid()}"
        create_lambda_function(
            func_name=function_name,
            zip_file=testutil.create_zip_file(TEST_LAMBDA_NODEJS, get_content=True),
            runtime=runtime,
            handler="lambda_handler.handler",
        )
        test_string = "test_string' with some quotes"
        body = f'{{"test_var": "{test_string}"}}'
        rs = lambda_client.invoke(
            FunctionName=function_name,
            Payload=body,
        )
        assert 200 == rs["ResponseMetadata"]["HTTPStatusCode"]
        rs = read_streams(rs)
        snapshot.match("invoke-result", rs)
        response = json.loads(rs["Payload"])
        assert "response from localstack lambda" in response["body"]
        def assert_events():
            events = get_lambda_log_events(function_name, logs_client=logs_client)
            assert len(events) > 0
            assert test_string in str(events[0])
        retry(assert_events, retries=10)
class TestCustomRuntimes: