IVS Player 1.3.1 - undefined property collectLogs


We upgraded to v1.3.1 and we are seeing the an undefined property on the amazon-ivs-wasmworker

amazon-ivs-wasmworker.min.js:5 Uncaught (in promise) TypeError: Cannot read property 'collectLogs' of undefined
at printErr (amazon-ivs-wasmworker.min.js:5)
at amazon-ivs-wasmworker.min.js:5

Has anyone else run across this yet? Thanks in advanced

asked 3 years ago379 views
8 Answers
Accepted Answer

Hi Guys,

I ran across this exact issue and when googling the error message, this was the only page that popped up.

First I tried resolving this using CSP headers, as suggested by @riley-aws.
Unfortunately this did not do the trick.

So I dug a little deeper, and using a break point where the error occured, I was able to get the error details. This was quite interesting indeed and lead me to learn why the wasm file couldn't be executed.

Here's the error:

"wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'."

Obviously the solution was to add the 'application/wasm' mime type header for .wasm files.
I did that and it worked.

Hope this helps someone else!

To amazon I suggest to catch these promise errors to maybe log them with a little bit more context. Had I seen this error message in the console, I'd immediately have known what's up. If there's more I can do to help with this, pls let me know.

Edited by: janpaepke on Jun 9, 2021 5:54 AM

answered 3 years ago

This error is potentially being caused by a limitation with the Content Security Policy(CSP) on the browser being used. More information on this behavior can be found https://docs.aws.amazon.com/ivs/latest/userguide/player-web.html#web-content-security-policy

Due to Safari's limited CSP support, it requires a very lenient CSP policy (one including unsafe-eval). This works against the whole point of CSP, to limit dangerous JavaScript from running on a page. With Safari, to avoid having dangerous JavaScript run on your page, we recommend that you host the library assets on the same origin as your page and use our same-origin CSP policy.

Seeing as the error being seen is a relatively generic error, it would be beneficial if we could better understand if there is a CSP policy in place on your webpage? As well, if there is any sample code that you are able/willing to share, please feel free to include that, as it may help indicate why this error is being thrown.

answered 3 years ago

Did you find a solution to this issue?

I'm having the exact same problem here. I tried to add the CSP configs (didn't have it on the server), but the issue still happens.

answered 3 years ago

We have not found a solution yet, and have been running an older version in the interim. We will keep you posted on our findings as we find a way to complete the upgrade.

answered 3 years ago

Thank you, this is a great find. I checked the mime type and found it was declared as binary/octet-stream.

I'll need to update my CI to set "application/wasm" properly when uploading to S3. Attaching a sample here for future reference:

aws s3 cp website/ s3://$WEBSITE_BUCKET --recursive --exclude "*.wasm"
aws s3 cp website/ s3://$WEBSITE_BUCKET --recursive \
--content-type "application/wasm" \
--exclude "" --include ".wasm"

answered 3 years ago

Hi All,
I am also facing the same error, having already in place the mentioned content type. Actually, I am hosting the js library and wasm file from CDN. It works in the beginning but started to throw this error after an hour and a half of smooth running.

Previously, we were using version 1.1.2, which doesn't seem to have this error. However, there we were facing memory errors in that version, as we had frequent switching between different feeds on the browser.

Please see attached screenshots.

Edited by: Sala on Jun 10, 2021 10:24 PM

answered 3 years ago

Only this solution works perfectly. Thank you very much

answered 3 years ago

Thank you AWS team for adding information regarding setting the Content-Type header on hosted assets.

For future reference of those reading this thread - https://docs.aws.amazon.com/ivs/latest/userguide/player-web.html - section "Setup With NPM"

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions