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

MicroBit V2: navigator.bluetooth.getDevices is not a function #40

Open
makermelissa opened this issue Nov 23, 2022 · 4 comments
Open

MicroBit V2: navigator.bluetooth.getDevices is not a function #40

makermelissa opened this issue Nov 23, 2022 · 4 comments
Labels
BLE Workflow bug Something isn't working

Comments

@makermelissa
Copy link
Collaborator

CircuitPython version

adafruit-circuitpython-microbit_v2-en_US-7.3.3.combined.hex; microbit_v2

Code/REPL

code.circuitpython.org

Behavior

Uncaught (in promise) TypeError: navigator.bluetooth.getDevices is not a function

Argh: NetworkError: Connection failed for unknown reason.

Description

203449116-1fa65865-28fe-46ba-a5c7-4a08df912188

Additional information

No response

@makermelissa makermelissa added bug Something isn't working BLE Workflow labels Nov 23, 2022
@makermelissa makermelissa changed the title code.circuitpython.org: navigator.bluetooth.getDevices is not a function MicroBit V2: navigator.bluetooth.getDevices is not a function Nov 23, 2022
@beaufortfrancois
Copy link
Contributor

beaufortfrancois commented Nov 24, 2022

navigator.bluetooth.getDevices() is available only when the user enabled the flag "chrome://flags/#enable-web-bluetooth-new-permissions-backend". You can follow https://bugs.chromium.org/p/chromium/issues/detail?id=577953 progress to know when this feature will be enabled by default for all users.

See #8

@makermelissa
Copy link
Collaborator Author

That's correct, but there's code in place that should have detected and alerted the user. So a part of the issue is figuring out why that didn't happen.

@beaufortfrancois
Copy link
Contributor

beaufortfrancois commented Nov 25, 2022

I believe it's because there's no try/catch around these calls below:

const devices = await navigator.bluetooth.getDevices();

let devices = await navigator.bluetooth.getDevices();

This call below on the other hand is properly handled.

const devices = await navigator.bluetooth.getDevices();

@makermelissa
Copy link
Collaborator Author

Yeah, it's probably a good idea to add that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BLE Workflow bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants