AWS SageMaker缺少必需的参数params [:body]

时间:2020-10-02 15:23:06

标签: amazon-web-services aws-sdk amazon-sagemaker

我尝试运行aws-sdk-sagemakerruntime gem版本1.27.0,并尝试了1.26.0

SAGE_MAKER_CLIENT = Aws::SageMakerRuntime::Client.new(params)
irb(main):081:0> SAGE_MAKER_CLIENT.invoke_endpoint()
Traceback (most recent call last):
        2: from (irb):81
        1: from (irb):81:in `rescue in irb_binding'
ArgumentError (parameter validator found 2 errors:)
  - missing required parameter params[:endpoint_name]
  - missing required parameter params[:body]

好的,我们添加endpoint_name

irb(main):082:0> SAGE_MAKER_CLIENT.invoke_endpoint(endpoint_name: 'testing')
Traceback (most recent call last):
        2: from (irb):82
        1: from (irb):82:in `rescue in irb_binding'
ArgumentError (missing required parameter params[:body])
irb(main):083:0> 

完美,我添加了endpoint_name,缺少的参数消失了

irb(main):083:0> SAGE_MAKER_CLIENT.invoke_endpoint(endpoint_name: 'testing', body: 'testing')
Traceback (most recent call last):
        2: from (irb):83
        1: from (irb):83:in `rescue in irb_binding'
ArgumentError (missing required parameter params[:body])

它还在要求身体吗?但为什么?让我们看看为您不期望的主体添加输入类型时会发生什么

irb(main):084:0> SAGE_MAKER_CLIENT.invoke_endpoint(endpoint_name: 'testing', body: {})
Traceback (most recent call last):
        2: from (irb):84
        1: from (irb):84:in `rescue in irb_binding'
ArgumentError (expected params[:body] to be a String or IO like object that supports read, rewind, and size, got value {} (class: Hash) instead.)

我很困惑。

错误是说我没有经过身体,但我显然是。我在这里做错了什么? 我还尝试过将字面上的示例复制并粘贴到此处的文档中:

https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/SageMakerRuntime/Client.html

0 个答案:

没有答案