{"record":{"id":"1556c55f2ff1d937","repo":"quickwit-oss/quickwit","slug":"created-function-has-no-version-number","errorCode":null,"errorMessage":"created function has no version number","messagePattern":"created function has no version number","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-lambda-client/src/deploy.rs","lineNumber":333,"sourceCode":"        .runtime(Runtime::Providedal2023)\n        .role(&deploy_config.execution_role_arn)\n        .handler(\"bootstrap\")\n        .description(description)\n        .code(function_code)\n        .architectures(Architecture::Arm64)\n        .memory_size(memory_size_mb)\n        .timeout(timeout_secs)\n        .environment(build_environment())\n        .set_tags(Some(build_tags()))\n        .publish(true)\n        .send()\n        .await;\n\n    match create_result {\n        Ok(output) => {\n            let version = output\n                .version()\n                .ok_or_else(|| anyhow!(\"created function has no version number\"))?\n                .to_string();\n            info!(\n                function_name = %function_name,\n                version = %version,\n                \"lambda function created and published\"\n            );\n            Ok(Some(version))\n        }\n        Err(SdkError::ServiceError(err)) if err.err().is_resource_conflict_exception() => {\n            debug!(\n                function_name = %function_name,\n                \"lambda function already exists\"\n            );\n            Ok(None)\n        }\n        Err(e) => Err(anyhow!(\n            \"failed to create Lambda function '{}': {}\",\n            function_name,","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-lambda-client/src/deploy.rs#L315-L351","documentation":"After creating and publishing a new Lambda function version, `try_create_function` reads the version number from the AWS response. If `CreateFunctionOutput.version()` is None — i.e. AWS did not return a published version despite the call succeeding — the code treats it as an anomaly and fails, since deploying without a concrete version ARN is meaningless. This guards against an unexpected AWS response shape.","triggerScenarios":"`create_function` succeeds but the output has no version field — e.g. the function was created without `Publish=true` semantics being honored, an SDK/response incompatibility after an AWS API or SDK version change, or an anomalous empty response from the service.","commonSituations":"AWS SDK version upgrade changing how `version()` behaves; Lambda API returning a partial response; deploy automation running against a mocked/legacy endpoint that omits the version field.","solutions":["Verify the create call publishes a version (check that the deploy code requests publication) and inspect the raw AWS response.","Check for an AWS SDK for Rust update that changed `version()` semantics; pin or update the SDK accordingly.","Retry the operation — if it persists, create the function without publish and then call `publish_version` explicitly to obtain a version.","Log the full `CreateFunctionOutput` to confirm whether AWS returned a version."],"exampleFix":"// before\nlet version = output.version().ok_or_else(|| anyhow!(\"created function has no version number\"))?.to_string();\n// after: publish explicitly if version missing\nlet version = match output.version() {\n    Some(v) => v.to_string(),\n    None => {\n        let published = client.publish_version().function_name(function_name).send().await?;\n        published.version().ok_or_else(|| anyhow!(\"published version missing\"))?.to_string()\n    }\n};","handlingStrategy":"try-catch","validationCode":"// after create, check the response carries a version before using it\nif create_output.version().is_none() {\n    warn!(\"CreateFunction returned no version; falling back to publish_version\");\n}","typeGuard":"fn has_version(out: &CreateFunctionOutput) -> Option<String> {\n    out.version().map(|v| v.to_string())\n}","tryCatchPattern":"match deploy_lambda_function(...).await {\n    Err(e) if e.to_string().contains(\"created function has no version number\") => {\n        warn!(\"missing version in CreateFunction response; publishing explicitly\");\n        let published = lambda.publish_version().function_name(name).send().await?;\n        use_published_version(published)?;\n    }\n    other => other?,\n}","preventionTips":["Log the full CreateFunctionOutput to detect anomalous AWS responses early.","Pin the AWS SDK version and test deploys after SDK upgrades.","Fall back to an explicit publish_version call whenever the create response omits a version."],"tags":["aws","lambda","deployment","api-response"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}