Skip to content
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

All works (after some modification), except viewing image frames #57

Open
LozGMK opened this issue Sep 14, 2020 · 0 comments
Open

All works (after some modification), except viewing image frames #57

LozGMK opened this issue Sep 14, 2020 · 0 comments

Comments

@LozGMK
Copy link

LozGMK commented Sep 14, 2020

Thank you @moanany for creating this example. There is a lot going on in it!

I think I have a similar problem to that in issue #55 (though their description is brief, so I can't be sure). That is that images are not obtained from the S3 bucket and put into the web UI frames, to the left of the "Detected objects" section (in the div with a class of container-img).

To get this working I firstly had to avoid using the commands pynt videocaptureip[ip_address,30] or pynt videocapture[30], as those led to errors of No module named 'boto3' and No module named 'cv2', respectively, despite running them as described in the instructions (with both of the boto3 and cv2 libraries installed, and tested as working).

Instead, I had to run the Python scripts directly, using py client\video_cap_ipcam.py ip_address 30 or py client\video_cap.py 30 (from the root directory of the project). That worked to acquire images from an IP camera or USB/internal webcam, respectively, without the library-related errors that the pynt commands gave me.

The other pynt commands worked fine for me (well, there are occasional errors, but if they are re-run or some offending item like a rolled back stack is manually deleted, they work fine).

Secondly, once one or the other camera was sending images to Kinesis, another error appeared to be causing the images not to show in the web UI frames. The easiest way to see the error appeared to be to (try and) open the (broken link) image in a new tab (using right-click, Open image in new tab, in Chrome or similar). That showed the full request (URL + extras) used to try and obtain the image (in the address bar) and an XML error in the body of the page, something like:

<Error> <Code>AuthorizationQueryParametersError</Code> <Message>X-Amz-Expires must be less than a week (in seconds); that is, the given X-Amz-Expires must be less than 604800 seconds</Message> <RequestId>D66...5D7</RequestId> <HostId>erwJSN/UdHX...YR9e/Ek=</HostId> </Error>

The error there was due to the code in the file config\framefetcher-params.json (as downloaded from this GitHub repository) containing a value of 2419200 seconds (28 days), for the parameter named s3_pre_signed_url_expiry. If that was set to, say 3600, (or the 1800 that was mentioned in the readme file, but not set in the code), then the error went away. It was replaced, for me, with another error, though.

After replacing the value as described above, the images still did not download, but now gave error messages of the following form (when the image was "opened" in a new tab):

<Error> <Code>SignatureDoesNotMatch</Code> <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message> <AWSAccessKeyId>ASIA2X...W4OYG</AWSAccessKeyId> <StringToSign>AWS4-HMAC-SHA256 20200914T151022Z 20200914/eu-west-2/s3/aws4_request b3aa8136ff77a983...1377818f5eaa2eb</StringToSign> <SignatureProvided>1814d...76d381</SignatureProvided> <StringToSignBytes>41 57 53 34 2d ... 32 65 62</StringToSignBytes> <CanonicalRequest>GET /frames/2020/09/14/16/6006d86b-cfb1-439f-ae0c-9c8d9849406b.jpg X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA2X...W4OYG%2F20200914%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20200914T151022Z&X-Amz-Expires=86400&X-Amz-Security-Token=IQoJ...37PLLC&X-Amz-SignedHeaders=host host:cam-project-video-frames-001.s3.eu-west-2.amazonaws.com host UNSIGNED-PAYLOAD</CanonicalRequest> <CanonicalRequestBytes>47 45 54 0a 2f ... 41 59 4c 4f 41 44</CanonicalRequestBytes> <RequestId>8314...1FED5</RequestId> <HostId>5O1ifrW...KO53Ftr+nU=</HostId> </Error>

I have put in ellipses (...) above where parts are long and/or may be security issues.

So that seems that the signature might not be created properly (or some similar reason). Everything else but this works, though, so I don't think the security credentials (set when running aws configure in the AWS CLI) can be wrong, except perhaps that the credentials shown in the error message above are temporary security credentials (if I understand what is going on), as the AWSAccessKeyId given above differs from that used for the user I was working with in my AWS account (and set when running aws configure).

I have been looking at this for days, now (I'm new to these technologies and languages), and not got to the bottom of what might be causing the issue in downloading these images from the S3 bucket.

Any help or advice would be very gratefully received.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant