title: Publish Lambda Function in AWS
body: <p>I am attempting to publish a new Lambda function if it doesn't already exist.  The Update seems to be working great, and I can update it at will. However when I try to do the Publish command I keep getting the error <code>Member must not be null</code></p>
  
  <pre><code>$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()
  }
  </code></pre>
  
  <p>If I run the Publish-LMFunction without all of the parameters and enter things manually I still get the error. Is there something obvious I'm messing? I believe I have all 4 required fields added to my Publish function. I can also create these within the webconsole, so I don't think it's a credentials issue.</p>