faro-web-sdk icon indicating copy to clipboard operation
faro-web-sdk copied to clipboard

fix: Check for undefined faro instancein isWebStorageAvailable catch block

Open edkimmel opened this issue 11 months ago • 4 comments
trafficstars

Why

If storage throws an exception during the module init calls to isWebStorageAvailable, the global faro instance is not set and this crashes.

What

Optional chain the faro instance itself in this catch block.

Links

Checklist

  • [ ] Tests added
  • [ ] Changelog updated
  • [ ] Documentation updated

edkimmel avatar Dec 05 '24 17:12 edkimmel

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Dec 05 '24 17:12 CLAassistant

The logs we are seeing on our end are TypeError: Cannot read property 'internalLogger' of undefined.

I have not been able to reproduce locally. Scanning through faro, I believe this is the only callsite that could produce that error. The other calls to faro.internalLogger all check some other property of the global faro instance (faro.config) first, which would be the line thrown from instead.

edkimmel avatar Dec 11 '24 15:12 edkimmel

The logs we are seeing on our end are TypeError: Cannot read property 'internalLogger' of undefined.

I have not been able to reproduce locally. Scanning through faro, I believe this is the only callsite that could produce that error. The other calls to faro.internalLogger all check some other property of the global faro instance (faro.config) first, which would be the line thrown from instead.

Hey once again. I was on PTO last week so apologies for catching up with your replies a week later. Do you have any other stack traces that might be helpful? Although I am leaning towards your original change being the solution. I just want to get more context so that we can have precedence and ideally create a test for it

kpelelis avatar Dec 16 '24 10:12 kpelelis

Hi @edkimmel want to follow up on this.

Do you still run into the issue?

codecapitano avatar Jan 30 '25 09:01 codecapitano