title: "GATT Error: Not paired." with web-bluetooth when device shows as connected
body: <p>I'm trying to connect to a Microchip "RN4678" dual mode bluetooth device from my Windows 10 machine using BLE with the web bluetooth api. I can find the device -> the service -> the characteristic I need but I keep getting a "GATT Error: Not paired." when trying to start notifications on the characteristic.</p>
  
  <p>My JavaScript experience is minimal, so I thought that I may have been chaining my promises wrong, however printing out the device info directly before trying to add the characteristic shows the value for "connected" as true.</p>
  
  <p>I have also verified that the device, service, and characteristic work as intended with the "nRF Connect" app on my android device.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>let targetService = '49535343-fe7d-4ae5-8fa9-9fafd205e455';
  let txCharacteristicId = '49535343-1e4d-4bd9-ba61-23c647249616';
  let rxCharacteristicId = '49535343-8841-43f4-a8d4-ecbe34729bb3';
  
  function onButtonClick(event) {
  
    // Find bluetooth device
    console.log('Requesting Bluetooth Device...');
    navigator.bluetooth.requestDevice({
      acceptAllDevices: true,
      optionalServices: [targetService]
    })
    // Connect to device
    .then(device =&gt; device.gatt.connect())
    // Get the server we want
    .then(server =&gt; {
      console.log('Getting UART transparent service...');
      return server.getPrimaryService(targetService);
    })
    // Handle the characteristics we need
    .then(service =&gt; {
      return service.getCharacteristic(txCharacteristicId)
    })
    .then(characteristic =&gt; {
      console.dir(characteristic.service.device);
      return characteristic.startNotifications();
    })
    .then(characteristic =&gt; {
      characteristic.addEventListener('characteristicvaluechanged',
                                      handleTx);
    })
    .catch(error =&gt; { 
      console.log(error);
      console.log(error.code);
      console.log(error.message); 
      console.log(error.name); 
    });
  
  }
  
  function handleTx(event) {
    console.log(event.target.value);
  }
  </code></pre>
  
  <p>And here are the console messages I get:</p>
  
  <pre><code>index.html:18 Requesting Bluetooth Device...
  index.html:27 Getting UART transparent service...
  index.html:35 BluetoothDevice
                  gatt: BluetoothRemoteGATTServer
                    connected: true
                    device: BluetoothDevice {id: "p+lJYscejR+Xl4eX+VbNkA==", name: "Dual-SPP", gatt: BluetoothRemoteGATTServer, ongattserverdisconnected: null}
                    __proto__: BluetoothRemoteGATTServer
                  id: "p+lJYscejR+Xl4eX+VbNkA=="
                  name: "Dual-SPP"
                  ongattserverdisconnected: null
                  __proto__: BluetoothDevice
  index.html:44 DOMException
  index.html:45 19
  index.html:46 GATT Error: Not paired.
  index.html:47 NetworkError
  </code></pre>
  
  <p>Here is the documentation for the web bluetooth startNotifications() function (<a href="https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-startnotifications" rel="nofollow noreferrer">https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-startnotifications</a>):</p>
  
  <blockquote>
    <p>The startNotifications() method, when invoked, MUST return a new
    promise promise and run the following steps in parallel. See §5.6.4
    Responding to Notifications and Indications for details of receiving
    notifications.</p>
    
    <ol>
    <li>If this.uuid is blocklisted for reads, reject promise with a SecurityError and abort these steps.</li>
    <li>If this.service.device.gatt.connected is false, reject promise with a NetworkError and abort these steps.</li>
    <li>Let characteristic be this.[[representedCharacteristic]].</li>
    <li>If characteristic is null, return a promise rejected with an InvalidStateError and abort these steps.</li>
    <li>If neither of the Notify or Indicate bits are set in characteristic’s properties, reject promise with a NotSupportedError
    and abort these steps.</li>
    <li>If characteristic’s active notification context set contains navigator.bluetooth, resolve promise with this and abort these steps.</li>
    <li><p>If the UA is currently using the Bluetooth system, it MAY reject promise with a NetworkError and abort these steps.   ISSUE 9:
    Implementations may be able to avoid this NetworkError, but for now
    sites need to serialize their use of this API and/or give the user a
    way to retry failed operations.
    <a href="https://github.com/WebBluetoothCG/web-bluetooth/issues/188" rel="nofollow noreferrer">https://github.com/WebBluetoothCG/web-bluetooth/issues/188</a></p></li>
    <li><p>If the characteristic has a Client Characteristic Configuration descriptor, use any of the Characteristic Descriptors procedures to
    ensure that one of the Notification or Indication bits in
    characteristic’s Client Characteristic Configuration descriptor is
    set, matching the constraints in characteristic’s properties. The UA
    SHOULD avoid setting both bits, and MUST deduplicate value-change
    events if both bits are set. Handle errors as described in §5.7 Error
    handling.   Note: Some devices have characteristics whose properties
    include the Notify or Indicate bit but that don’t have a Client
    Characteristic Configuration descriptor. These non-standard-compliant
    characteristics tend to send notifications or indications
    unconditionally, so this specification allows applications to simply
    subscribe to their messages.</p></li>
    <li><p>If the previous step returned an error, reject promise with that error and abort these steps.</p></li>
    <li>Add navigator.bluetooth to characteristic’s active notification context set.</li>
    <li>Resolve promise with this.   After notifications are enabled, the resulting value-change events won’t be delivered until after the
    current microtask checkpoint. This allows a developer to set up
    handlers in the .then handler of the result promise.</li>
    </ol>
  </blockquote>
  
  <p>Edit:
  I'm using Chrome version 74, Windows 10.0.17134</p>