question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ReferenceError: PublicKeyCredential is not defined

See original GitHub issue

Looks like platformAuthenticatorIsAvailable is missing a check for whether PublicKeyCredential is defined at all: https://github.com/MasterKale/SimpleWebAuthn/blob/master/packages/browser/src/helpers/platformAuthenticatorIsAvailable.ts#L8. Maybe just add (await browserSupportsWebAuthn()) && ..?

Also, minor nitpick: isPlatformAuthenticatorAvailable would seem like a more sensible name to me since it’s actually phrased like a question and not a statements plus it’s a little closer to the original method name. Food for thought 😊

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MaKleSoftcommented, Sep 1, 2021

My intention with naming the feature check methods what they are right now was to make the if statements they get used in sound almost like normal sentences:

Yeah that came to me as well after writing my comment. I guess it doesn’t really matter as long as the naming is somewhat consistent - and your version is in fact more consistent with browserSupportsWebAuthn. Well, you know what they say about naming in programming 😄 . Anyway, enough with the bikeshedding 🙊

0reactions
MasterKalecommented, Sep 1, 2021

This issue has been fixed in the new @simplewebauthn/browser@4.1.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to check browser is public-key credentials supported?
I am implementing webauthn using PHP, now I'm facing problem with how to detect browser is public-key credentials supported or not. If browser ......
Read more >
Microsoft Edge 42.17134.1.0 -> Error: ReferenceError ... - GitHub
Error: ReferenceError: 'PublicKeyCredential' is not defined ... It is not detecting Windows Hello as FIDO2 authenticator on Windows 10 version 1903 while ...
Read more >
PublicKeyCredential - Web APIs - MDN Web Docs - Mozilla
The PublicKeyCredential interface provides information about a public key / private key pair, which is a credential for logging in to a ...
Read more >
How to fix "Uncaught ReferenceError: x is not defined" in ...
JS Casts 04 - How to fix "Uncaught TypeError: x is not a function " in JavaScript.Visit https://javascriptcasts.com/episodes/04 for a summary ...
Read more >
PublicKeyCredential (webauthn-server-core 2.2.0 API)
A map containing extension identifier → client extension output entries produced by the extension's client extension processing. @NonNull ByteArray. getId().
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found