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.
inv_results = self._run_forward_to_fallback_url(
            local_url, lambda_name=lambda_name, fallback=False
        )
        items_after = len(records)
        for record in records:
            headers = record["headers"]
            self.assertIn("/lambda/", headers["Authorization"])
            self.assertEqual("POST", record["method"])
            self.assertIn("/functions/%s/invocations" % lambda_name, record["path"])
            self.assertTrue(headers.get("X-Amz-Client-Context"))
            self.assertEqual("RequestResponse", headers.get("X-Amz-Invocation-Type"))
            self.assertEqual({"foo": "bar"}, json.loads(to_str(record["data"])))
        self.assertEqual(3, items_after)
        
        response_payload = inv_results[0]["Payload"].read()
        self.assertEqual(lambda_result, json.loads(response_payload))
        
        lambda_client = aws_stack.create_external_boto_client("lambda")
        lambda_client.delete_function(FunctionName=lambda_name)
        proxy.stop()
    def test_adding_fallback_function_name_in_headers(self):
        lambda_client = aws_stack.create_external_boto_client("lambda")
        ddb_client = aws_stack.create_external_boto_client("dynamodb")
        db_table = "lambda-records"
        config.LAMBDA_FALLBACK_URL = f"dynamodb://{db_table}"
        lambda_client.invoke(
            FunctionName="non-existing-lambda",
            Payload=b"{}",
            InvocationType="RequestResponse",
        )