4

如果新的 Lambda 函数尚不存在,我正在尝试发布它。更新似乎很好用,我可以随意更新。但是,当我尝试执行发布命令时,我不断收到错误Member must not be null

$zipFilePath = "E:\ProductName-Dev\release.zip"
$zipFileItem = Get-Item -Path $zipFilePath
$fileStream = $zipFileItem.OpenRead()
$memoryStream = New-Object System.IO.MemoryStream
$fileStream.CopyTo($memoryStream)   

$cmdOutput = Get-LMFunction -FunctionName new-extract;

try{
    if($?) {
        "lambda function already in AWS"               
        Update-LMFunctionCode -FunctionName new-extract -ZipFile $memoryStream -Publish 1

    } else {
        "need to publish new lambda function"           
        Publish-LMFunction -FunctionName new-extract -FunctionZip $zipFilePath -Handler exports.handler -Role arn:aws:iam::0000000:role/my-extract -Region us-east-1 
    }
}
finally {
    $fileStream.Close()
}

如果我在没有所有参数的情况下运行 Publish-LMFunction 并手动输入内容,我仍然会收到错误消息。有什么明显的我在搞砸吗?我相信我已将所有 4 个必填字段添加到我的发布功能中。我也可以在 webconsole 中创建这些,所以我认为这不是凭据问题。

4

1 回答 1

4

我只是错过了运行时参数

Publish-LMFunction -FunctionName $FunctionName -FunctionZip $zipFilePath -Handler exports.handler -Role arn:aws:iam:$AccountNumber:role/$RoleName -Region $Region -Runtime nodejs4.3

他们的文档根据需要显示它,但是当您在 Powershell ISE 中编写时,它不会在字段旁加上星号。

于 2016-10-28T19:59:21.013 回答