-
Notifications
You must be signed in to change notification settings - Fork 158
Open
Description
detectrtc when used with pdfjs-dist in node.js environment produces an error due to incomplete polyfill for navigator in the detectrtc.
Error
isWin: navigator.platform.includes("Win"),
^
TypeError: Cannot read properties of undefined (reading 'includes')
Cause of error
In node.js environment we don't get navigator object - pdfjs-dist makes a decision based on the presence of navigator object i.e. if present it tries to access navigator.platform.<methods> which is reasonable.
When used with detectrtc it gets the navigator object (polyfill), as a result it goes and tries to access methods on platform property but since platform itself is unavailable, calling any method on top of it throws error.
Reference
- Issue reported in the
pdfjs-dist- navigator does not contain platform, therefore require('pdfjs-dist/build/pdf') leads to an error mozilla/pdf.js#15728 - Polyfills added in the detectrtc
- Error causing line in
pdfjs-dist
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels