boto3 icon indicating copy to clipboard operation
boto3 copied to clipboard

Can't start or stop streaming session with Nimble Studio API

Open alexbulygin opened this issue 3 years ago • 2 comments

Describe the bug

I'm trying to automate the start and stop of a streaming session using AWS Nimble Studio API.

Although I got the expected result using other API methods :

client.list_studios()
client.list_streaming_sessions()
client.tag_resource()
client.get_streaming_session()
client.create_streaming_session()
client.delete_streaming_session()

start_streaming_session() and stop_streaming_session() functions responds with "Unknown error parsing request body".

I've tried to use Nimble Python API with AWS Lambda Function with admin access policy attached; CLI on my local machine with account admin credentials; HTTPS request with account admin credentials using aws-requests-auth library for authentication.

All three results in "Unknown error parsing request body".

Expected Behavior

Start or stop streaming session respectivetly.

Current Behavior

An error occurred (ValidationException) when calling the StartStreamingSession operation: [Unknown error parsing request body]

Reproduction Steps

Example Python Request:

response = nimble_client.start_streaming_session(
        sessionId='my-streaming-session-id',
        studioId='my-studio-id'
)

Examble CLI Request: aws nimble start-streaming-session --session-id my-streaming-session-id --studio-id my-studio-id

Example HTTPs request using python and aws-requests-auth

auth = AWSRequestsAuth(aws_access_key='MY_KEY',
                       aws_secret_access_key='MY_SECRET_KEY',
                       aws_host='nimble.eu-west-2.amazonaws.com',
                       aws_region='eu-west-2',
                       aws_service='nimble')

response = requests.post('https://nimble.eu-west-2.amazonaws.com/2020-08-01/studios/my-studio-id/streaming-sessions/my-streaming-session-id/start', auth=auth)

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.24.40

Environment details (OS name and version, etc.)

AWS Lambda Python 3.9, MacOS 12.4 Python 3.8.2

alexbulygin avatar Jul 29 '22 16:07 alexbulygin

Hi @alexbulygin thanks for reaching out. Could you provide your debug logs (with any sensitive info redacted) by adding boto3.set_stream_logger('') to your script? I'm not very familiar with Nimble Studio, you may want to also consider asking the re:Post community or AWS Support for issues related to that service.

tim-finnigan avatar Jul 29 '22 21:07 tim-finnigan

Here is the entire script

import boto3

boto3.set_stream_logger('')
session = boto3.Session(aws_access_key_id='my-admin-key', aws_secret_access_key='my-admin-secret-key')
nimble_client = session.client('nimble', region_name = 'eu-west-2')
studio_id = nimble_client.list_studios()['studios'][0]['studioId']
sessions = nimble_client.list_streaming_sessions(studioId=studio_id)['sessions']

for session in sessions:
    if session['state'] == "STOPPED" and \
        session['tags']['aws:nimble:createdWithLaunchProfile'] == 'my-launch-profile-id':
            the_session = session

if the_session:
    response = nimble_client.get_streaming_session(sessionId=the_session['sessionId'],studioId=studio_id)
    response = nimble_client.start_streaming_session(sessionId=the_session['sessionId'],studioId=studio_id)

And here are the logs: nimble_studio_logs.txt

alexbulygin avatar Jul 30 '22 14:07 alexbulygin

Checking in - thanks for your patience. This seems to have been a service API issue that has since been resolved per this post. If you're still running into this after updating to the latest version of boto3 then please let us know and we can investigate further.

tim-finnigan avatar Nov 17 '22 23:11 tim-finnigan