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.

bug: Unhandled Promise Rejection: Haptics does not have web implementation.

See original GitHub issue

Bug Report

Ionic version:

[x] 5.0.7

Current behavior:

In mobile browsers, if I use the refresher I get an error about Haptics not having a web implementation. This doesn’t seem to affect the functionality, but the errors are piling up in our error handler.

Expected behavior:

The refresher should work without error.

Steps to reproduce:

Have a page that uses an IonRefresher and pull to refresh in mobile browsers.

Related code: The error report from the browser points to this line. That code is using getEngine to get the haptics engine and then testing for its existence before making the call to impact. getEngine does this to test for the existence of the engine:

(win.TapticEngine) || (win.Capacitor && win.Capacitor.Plugins.Haptics)

That seems to always return a Proxy object, so the test for existence in impact always passes so it tries to execute the haptic impact function, which fails when there isn’t an implementation of Haptics. It seems like in addition to getting the engine the getEngine function also needs to check to see if the feature is implemented.

A simple test is to run this in the dev console of the browser:

((window.TapticEngine) || (window.Capacitor && window.Capacitor.Plugins.Haptics)).impact()

this is what the code would try to do when using the refresher, and it should cause the error.

Other information:

Ionic info:

Ionic:

   Ionic CLI       : 5.4.13 (/usr/local/lib/node_modules/ionic)
   Ionic Framework : @ionic/react 5.0.7

Capacitor:

   Capacitor CLI   : 2.0.1
   @capacitor/core : 2.0.1

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v13.12.0 (/usr/local/Cellar/node/13.12.0/bin/node)
   npm    : 6.14.4
   OS     : macOS Catalina

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
aubcommented, Apr 29, 2020

Here’s a repo that reproduces the problem. All I did was take the basic app from ionic create and:

  • Added a refresher in the first tab here
  • That alone didn’t do it because when the getEngine function in HapticEngine got win.Capacitor it would get back undefined. So I added this to actually use Capacitor by hiding the splash screen, and now the bug is reproducible.

I can reproduce it in mobile safari by running npm run start then opening up a browser tab on my phone pointed at port 3000 on my local IP address. Then if I connect safari’s dev tools on my desktop to the tab on the phone I will see the error in the console.

1reaction
aubcommented, Apr 29, 2020

Ok, sorry for the interruption… I did get a test for this working and also can’t reproduce it. Let me mess with it some more to see if I can narrow it down and will close this ticket if not. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: Unhandled Promise Rejection: Haptics does not ... - GitHub
bug : Unhandled Promise Rejection: Haptics does not have web implementation ... I get an error about Haptics not having a web implementation....
Read more >
Uncaught (in promise): MyPlugin does not have web ...
I experienced this issue running Capacitor v2.4.7. It appears to be caused by the destructuring of the Plugins object:
Read more >
Uncaught (in promise): PushNotifications does not have web ...
ERROR Error : Uncaught (in promise): PushNotifications does not have web implementation. How to catch this exception for web implementation, ...
Read more >
AuthSession - Expo Documentation
AuthSession. AuthSession is the easiest way to add web browser based authentication (for example, browser-based OAuth flows) to your app, built on top...
Read more >
TextView - Android Developers
FOCUS_DOWN If the reference refers to a view that does not exist or is part ... of the TextView to the "error" icon...
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