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

navigator does not contain platform - require('pdfjs-dist') leads to error #116

Open
rajeshtezu opened this issue Jul 19, 2023 · 0 comments

Comments

@rajeshtezu
Copy link

rajeshtezu commented Jul 19, 2023

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

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