无法将环境变量传递给Ruby中的Create_Function AWS SDK方法

时间:2017-06-15 23:14:25

标签: ruby aws-lambda aws-sdk

我试图执行以下Ruby代码,并且它常常在params [:environment]"中出现意外值。错误。我尝试了很多不同的方法来将Hash传递给'环境'参数但它会触发相同的错误。

require 'aws-sdk'

client = Aws::Lambda::Client.new(region: 'us-east-1')
args = {}
args[:role] = "some_role"
args[:function_name] = "function"
args[:handler] = "function_handler"
args[:runtime] = "java8"

code = {}
code[:zip_file] = ::File.open("file.jar", "rb").read

args[:code] = code  

environment = {}
environment[:variables] = { "AAA": "BBB" } 
args[:environment] = environment

client.create_function(args)

1 个答案:

答案 0 :(得分:0)

通过将Ruby AWS SDK从2.6升级到2.9

来解决