-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validation Exception : Invalid Request when calling start_async_invoke [bedrock-runtime] #4382
Comments
Hi @gshr, thanks for reaching out. On AWS Bedrock Runtime docs page, I found this reference article for getting It would be helpful if you could please share the complete debug logs with us to get to the root cause. You could use this command for getting the debug logs - boto3.set_stream_logger('') Thanks |
Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one. |
I have the same issue. Is this resolved? |
No , but i believe start_async_invoke currently only support Amazon Nova Reel model .That is why i was getting above error while using with other models but not with Amazon Nova Reel . |
I get the same error when trying to invoke with Nova Reel.
Has anyone been able to get Nova Reel to work?
…________________________________
From: Gaurav Sharma ***@***.***>
Sent: Saturday, February 15, 2025 5:27:44 AM
To: boto/boto3 ***@***.***>
Cc: Bennie Boone ***@***.***>; Manual ***@***.***>
Subject: Re: [boto/boto3] Validation Exception : Invalid Request when calling start_async_invoke [bedrock-runtime] (Issue #4382)
I have the same issue. Is this resolved?
No , but i believe start_async_invoke currently only support Amazon Nova Reel model .That is why i was getting above error while using with other models but not with Amazon Nova Reel .
—
Reply to this email directly, view it on GitHub<#4382 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5PDABHGT5XT35KYH7ZTSVT2P46FBAVCNFSM6AAAAABURVX7AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRQHEZDKOJXG4>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
[gshr]gshr left a comment (boto/boto3#4382)<#4382 (comment)>
I have the same issue. Is this resolved?
No , but i believe start_async_invoke currently only support Amazon Nova Reel model .That is why i was getting above error while using with other models but not with Amazon Nova Reel .
—
Reply to this email directly, view it on GitHub<#4382 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5PDABHGT5XT35KYH7ZTSVT2P46FBAVCNFSM6AAAAABURVX7AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRQHEZDKOJXG4>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
yes i was able to get response from Nova Reel using start_async_invoke. https://docs.aws.amazon.com/nova/latest/userguide/video-gen-code-examples.html |
This helps. I think I am asking the wrong questions..
Is Nova Reel supported in AWS Lambda?
I am able to use Nova Canvas with Lambda, but for Nova Reel there is no “start_async_invoke” on the boto3.client("bedrock-runtime"). See the code below
I have added the following permissions to my lambda handler.
"s3:PutObject",
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream",
"bedrock:ListAsyncInvokes",
"bedrock:GetAsyncInvoke"
LAMBDA:
import json
import boto3
def lambda_handler(event, context):
#print(event)
# Create the Bedrock Runtime client.
bedrock_runtime = boto3.client("bedrock-runtime")
print(dir(bedrock_runtime))
model_input = {
"taskType": "TEXT_VIDEO",
"textToVideoParams": {
"text": "Closeup of a large seashell in the sand, gentle waves flow around the shell. Camera zoom in."
},
"videoGenerationConfig": {
"durationSeconds": 6,
"fps": 24,
"dimension": "1280x720",
"seed": 0, # Change the seed to get a different result
}
}
try:
# Start the asynchronous video generation job.
invocation = bedrock_runtime.start_async_invoke(
modelId="amazon.nova-reel-v1:0",
modelInput=model_input,
outputDataConfig={
"s3OutputDataConfig": {
"s3Uri": "s3://spark-gen-ai-nova-canvas/spark-video"
}
}
)
# Print the response JSON.
print("Response:")
print(json.dumps(invocation, indent=2, default=str))
except Exception as e:
print(e)
# Implement error handling here.
# message = e.response["Error"]["Message"]
message = e
print(f"Error: {message}")
return {
'statusCode': 200,
'body': json.dumps('Trying!')
}
Yields this error:
BedrockRuntime' object has no attribute 'start_async_invoke'
When I cal dir() on the client object 'start_async_invoke' is not in the list of attributes.
['_PY_TO_OP_NAME', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__firstlineno__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__static_attributes__', '__str__', '__subclasshook__', '__weakref__', '_cache', '_client_config', '_convert_to_request_dict', '_emit_api_params', '_endpoint', '_exceptions', '_exceptions_factory', '_get_credentials', '_get_waiter_config', '_load_exceptions', '_loader', '_make_api_call', '_make_request', '_register_handlers', '_request_signer', '_resolve_endpoint_ruleset', '_response_parser', '_ruleset_resolver', '_serializer', '_service_model', '_user_agent_creator', 'apply_guardrail', 'can_paginate', 'close', 'converse', 'converse_stream', 'exceptions', 'generate_presigned_url', 'get_paginator', 'get_waiter', 'invoke_model', 'invoke_model_with_response_stream', 'meta', 'waiter_names']
Thanks in advance,
Bennie
From: Gaurav Sharma ***@***.***>
Date: Saturday, February 15, 2025 at 9:24 AM
To: boto/boto3 ***@***.***>
Cc: Bennie Boone ***@***.***>, Manual ***@***.***>
Subject: Re: [boto/boto3] Validation Exception : Invalid Request when calling start_async_invoke [bedrock-runtime] (Issue #4382)
I get the same error when trying to invoke with Nova Reel.
Has anyone been able to get Nova Reel to work?
…
yes i was able to get response from Nova Reel using start_async_invoke.
https://docs.aws.amazon.com/nova/latest/userguide/video-gen-code-examples.html
—
Reply to this email directly, view it on GitHub<#4382 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5PDABFLHLHEOKMBJKW7MTT2P5Z2XAVCNFSM6AAAAABURVX7AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRRGAYTGMRYGA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
[Image removed by sender. gshr]gshr left a comment (boto/boto3#4382)<#4382 (comment)>
I get the same error when trying to invoke with Nova Reel.
Has anyone been able to get Nova Reel to work?
…
yes i was able to get response from Nova Reel using start_async_invoke.
https://docs.aws.amazon.com/nova/latest/userguide/video-gen-code-examples.html
—
Reply to this email directly, view it on GitHub<#4382 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5PDABFLHLHEOKMBJKW7MTT2P5Z2XAVCNFSM6AAAAABURVX7AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRRGAYTGMRYGA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
I am using Lambda Python 3.13 container.
From: Bennie Boone ***@***.***>
Date: Sunday, February 16, 2025 at 3:52 PM
To: boto/boto3 ***@***.***>, boto/boto3 ***@***.***>
Cc: Manual ***@***.***>
Subject: Re: [boto/boto3] Validation Exception : Invalid Request when calling start_async_invoke [bedrock-runtime] (Issue #4382)
This helps. I think I am asking the wrong questions..
Is Nova Reel supported in AWS Lambda?
I am able to use Nova Canvas with Lambda, but for Nova Reel there is no “start_async_invoke” on the boto3.client("bedrock-runtime"). See the code below
I have added the following permissions to my lambda handler.
"s3:PutObject",
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream",
"bedrock:ListAsyncInvokes",
"bedrock:GetAsyncInvoke"
LAMBDA:
import json
import boto3
def lambda_handler(event, context):
#print(event)
# Create the Bedrock Runtime client.
bedrock_runtime = boto3.client("bedrock-runtime")
print(dir(bedrock_runtime))
model_input = {
"taskType": "TEXT_VIDEO",
"textToVideoParams": {
"text": "Closeup of a large seashell in the sand, gentle waves flow around the shell. Camera zoom in."
},
"videoGenerationConfig": {
"durationSeconds": 6,
"fps": 24,
"dimension": "1280x720",
"seed": 0, # Change the seed to get a different result
}
}
try:
# Start the asynchronous video generation job.
invocation = bedrock_runtime.start_async_invoke(
modelId="amazon.nova-reel-v1:0",
modelInput=model_input,
outputDataConfig={
"s3OutputDataConfig": {
"s3Uri": "s3://spark-gen-ai-nova-canvas/spark-video"
}
}
)
# Print the response JSON.
print("Response:")
print(json.dumps(invocation, indent=2, default=str))
except Exception as e:
print(e)
# Implement error handling here.
# message = e.response["Error"]["Message"]
message = e
print(f"Error: {message}")
return {
'statusCode': 200,
'body': json.dumps('Trying!')
}
Yields this error:
BedrockRuntime' object has no attribute 'start_async_invoke'
When I cal dir() on the client object 'start_async_invoke' is not in the list of attributes.
['_PY_TO_OP_NAME', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__firstlineno__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__static_attributes__', '__str__', '__subclasshook__', '__weakref__', '_cache', '_client_config', '_convert_to_request_dict', '_emit_api_params', '_endpoint', '_exceptions', '_exceptions_factory', '_get_credentials', '_get_waiter_config', '_load_exceptions', '_loader', '_make_api_call', '_make_request', '_register_handlers', '_request_signer', '_resolve_endpoint_ruleset', '_response_parser', '_ruleset_resolver', '_serializer', '_service_model', '_user_agent_creator', 'apply_guardrail', 'can_paginate', 'close', 'converse', 'converse_stream', 'exceptions', 'generate_presigned_url', 'get_paginator', 'get_waiter', 'invoke_model', 'invoke_model_with_response_stream', 'meta', 'waiter_names']
Thanks in advance,
Bennie
From: Gaurav Sharma ***@***.***>
Date: Saturday, February 15, 2025 at 9:24 AM
To: boto/boto3 ***@***.***>
Cc: Bennie Boone ***@***.***>, Manual ***@***.***>
Subject: Re: [boto/boto3] Validation Exception : Invalid Request when calling start_async_invoke [bedrock-runtime] (Issue #4382)
I get the same error when trying to invoke with Nova Reel.
Has anyone been able to get Nova Reel to work?
…
yes i was able to get response from Nova Reel using start_async_invoke.
https://docs.aws.amazon.com/nova/latest/userguide/video-gen-code-examples.html
—
Reply to this email directly, view it on GitHub<#4382 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5PDABFLHLHEOKMBJKW7MTT2P5Z2XAVCNFSM6AAAAABURVX7AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRRGAYTGMRYGA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
[Image removed by sender. gshr]gshr left a comment (boto/boto3#4382)<#4382 (comment)>
I get the same error when trying to invoke with Nova Reel.
Has anyone been able to get Nova Reel to work?
…
yes i was able to get response from Nova Reel using start_async_invoke.
https://docs.aws.amazon.com/nova/latest/userguide/video-gen-code-examples.html
—
Reply to this email directly, view it on GitHub<#4382 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5PDABFLHLHEOKMBJKW7MTT2P5Z2XAVCNFSM6AAAAABURVX7AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRRGAYTGMRYGA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
@gshr , are you able to solve the problem following the mentioned sample code? |
I'm not. Did you see my code? |
Has anyone tried to important it through lamba?
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Shailja Khurana ***@***.***>
Sent: Monday, February 17, 2025 11:21:18 AM
To: boto/boto3 ***@***.***>
Cc: Bennie Boone ***@***.***>; Manual ***@***.***>
Subject: Re: [boto/boto3] Validation Exception : Invalid Request when calling start_async_invoke [bedrock-runtime] (Issue #4382)
I get the same error when trying to invoke with Nova Reel.
Has anyone been able to get Nova Reel to work?
…
yes i was able to get response from Nova Reel using start_async_invoke.
https://docs.aws.amazon.com/nova/latest/userguide/video-gen-code-examples.html
@gshr<https://github.com/gshr> , are you able to solve the problem following the mentioned sample code?
—
Reply to this email directly, view it on GitHub<#4382 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5PDABCGFG5SRYSXLTUAPWL2QIZC5AVCNFSM6AAAAABURVX7AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRTHEZDKOBVG4>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
[khushail]khushail left a comment (boto/boto3#4382)<#4382 (comment)>
I get the same error when trying to invoke with Nova Reel.
Has anyone been able to get Nova Reel to work?
…
yes i was able to get response from Nova Reel using start_async_invoke.
https://docs.aws.amazon.com/nova/latest/userguide/video-gen-code-examples.html
@gshr<https://github.com/gshr> , are you able to solve the problem following the mentioned sample code?
—
Reply to this email directly, view it on GitHub<#4382 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5PDABCGFG5SRYSXLTUAPWL2QIZC5AVCNFSM6AAAAABURVX7AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRTHEZDKOBVG4>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
@gshr, could you please help me in re-iterating the main issue here -
is that understanding correct ? if not, please re-iterate the main issue and if there is any other issue, please feel free to open another bug for that one. |
No.
We must use start_async_invoke for Nova Reel.
Nova Canvas uses InvokeModel.
I can use InvokeModel without issue. The problem is that starting_async_invoke is not present in the boto3 client in lambda.
I think the boto3 version in lambda doesn't support starting_async_invoke.
Can you provide code to upgrade boto3 to the latest version in Lambda?
…________________________________
From: Shailja Khurana ***@***.***>
Sent: Wednesday, February 19, 2025 3:27:17 PM
To: boto/boto3 ***@***.***>
Cc: Bennie Boone ***@***.***>; Manual ***@***.***>
Subject: Re: [boto/boto3] Validation Exception : Invalid Request when calling start_async_invoke [bedrock-runtime] (Issue #4382)
@gshr<https://github.com/gshr>, could you please help me in re-iterating the main issue here -
1. you are trying to access the LLM using start_async_invoke
2. this method works for Nova models as listed in this comment -#4382 (comment)<#4382 (comment)>
3. for all other models, this fails generating the "invalid request" error.
is that understanding correct ? if not, please re-iterate the main issue and if there is any other issue, please feel free to open another bug for that one.
Thanks
—
Reply to this email directly, view it on GitHub<#4382 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5PDABGFW4RT3UI45ZFNJQD2QUHMRAVCNFSM6AAAAABURVX7AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRZHE4TGMRZGA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
[khushail]khushail left a comment (boto/boto3#4382)<#4382 (comment)>
@gshr<https://github.com/gshr>, could you please help me in re-iterating the main issue here -
1. you are trying to access the LLM using start_async_invoke
2. this method works for Nova models as listed in this comment -#4382 (comment)<#4382 (comment)>
3. for all other models, this fails generating the "invalid request" error.
is that understanding correct ? if not, please re-iterate the main issue and if there is any other issue, please feel free to open another bug for that one.
Thanks
—
Reply to this email directly, view it on GitHub<#4382 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5PDABGFW4RT3UI45ZFNJQD2QUHMRAVCNFSM6AAAAABURVX7AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRZHE4TGMRZGA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
|
Thanks for clarifying there @gshr. The AWS Boto3 doc mention this pre-requisite for using start_async_invoke()-
I am facing such error in using many models which I have access to. I am not able to find any doc which mentions the support for Nova model by start_async_invoke. IMO, this looks like a Service API Issue. I will file a ticket with the team and share updates soon. Thanks for having patience! |
Shailja Khurana and Team,
Thanks for you help. I have not been able to get it to work with the required permissions. I’ll wait to hear back from you.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream",
"bedrock:ListAsyncInvokes",
"bedrock:GetAsyncInvoke"
],
"Resource": "*"
}
]
}
From: Shailja Khurana ***@***.***>
Date: Friday, February 21, 2025 at 3:17 PM
To: boto/boto3 ***@***.***>
Cc: Bennie Boone ***@***.***>, Manual ***@***.***>
Subject: Re: [boto/boto3] Validation Exception : Invalid Request when calling start_async_invoke [bedrock-runtime] (Issue #4382)
Thanks for clarifying there @gshr<https://github.com/gshr>. The AWS Boto3 doc mention this pre-requisite for using start_async_invoke()-
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-runtime/client/start_async_invoke.html
This operation requires permission for the bedrock:InvokeModel action.
I am facing such error in using many models which I have access to. I am not able to find any doc which mentions the support for Nova model by start_async_invoke.
IMO, this looks like a Service API Issue. I will file a ticket with the team and share updates soon.
Thanks for having patience!
—
Reply to this email directly, view it on GitHub<#4382 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5PDABHQ6YPLA3OCJOEL6YT2Q6XZ7AVCNFSM6AAAAABURVX7AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZVHAYDINBZGQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
[khushail]khushail left a comment (boto/boto3#4382)<#4382 (comment)>
Thanks for clarifying there @gshr<https://github.com/gshr>. The AWS Boto3 doc mention this pre-requisite for using start_async_invoke()-
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-runtime/client/start_async_invoke.html
This operation requires permission for the bedrock:InvokeModel action.
I am facing such error in using many models which I have access to. I am not able to find any doc which mentions the support for Nova model by start_async_invoke.
IMO, this looks like a Service API Issue. I will file a ticket with the team and share updates soon.
Thanks for having patience!
—
Reply to this email directly, view it on GitHub<#4382 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5PDABHQ6YPLA3OCJOEL6YT2Q6XZ7AVCNFSM6AAAAABURVX7AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZVHAYDINBZGQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Describe the bug
I am using boto3 to connect bedrock-runtime and invoke model mistral.mistral-small-2402-v1:0 using start_async_invoke. However , the error message occur when i execute the code
ERROR:root:Failed to start async invoke: An error occurred (ValidationException) when calling the StartAsyncInvoke operation: The provided request is not valid
ERROR:root:An error occurred: An error occurred (ValidationException) when calling the StartAsyncInvoke operation: The provided request is not valid
And this is my implementation:
Regression Issue
Expected Behavior
Success Response from api
Current Behavior
Reproduction Steps
Replace s3_uri with your bucket in implementation above
Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.35.91
Environment details (OS name and version, etc.)
macOS
The text was updated successfully, but these errors were encountered: