2016-10-26 137 views
3

我试图发布新的Lambda函数,如果它尚不存在。更新似乎很好,我可以随意更新。然而,当我尝试做发布命令我不断收到错误Member must not be null在AWS中发布Lambda函数

$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() 
} 

如果我跑的发布,LMFunction没有所有的参数,并进入手工的东西我仍然得到错误。有什么明显的我搞乱了吗?我相信我的所有4个必填字段都添加到了我的发布功能中。我也可以在webconsole中创建它们,所以我不认为这是一个凭证问题。

回答

3

我只是缺少运行参数

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

他们的文档显示它作为必需的,但是当你在PowerShell ISE中写它不通过现场放一个星号。