0
我試圖執行以下Ruby代碼,並且它經常以「params [:environment]的意外值」錯誤失敗。我嘗試了許多不同的選項來將Hash傳遞給'environment'參數,但它觸發了同樣的錯誤。無法將環境變量傳遞到Ruby中的Create_Function AWS SDK方法
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)