Troubleshooting2 min read
Troubleshooting JavaScript Bridge Issues
Fix common JavaScript Bridge problems: window.wapp undefined, PLUGIN_NOT_ENABLED, BRIDGE_NOT_ALLOWED, PERMISSION_DENIED and platform differences.
Check these in order
- You are testing inside the app.
window.wappexists only in the app, never in a desktop or mobile browser. - Your code runs after the bridge is ready. Use the
wapp:readyevent orwapp_library_ready(); see the quickstart. - The page is allowed. With restrictions on, its URL must be listed in Website access.
- The plugin is on, in your plan, and in this build. Plugins are compiled in: build again after turning one on.
- The device permission is on in Permissions › Device and the user allowed it.
- Your site does not define its own
wappvariable. If it does, turn off Define window.wapp.
By error code
| Code | Fix |
|---|---|
window.wapp is undefined | Test in the app; wait for wapp:ready; check Website access and Define window.wapp |
PLUGIN_NOT_ENABLED | details.reason says why: turn the plugin on, check your plan, or install a build made after turning it on |
BRIDGE_NOT_ALLOWED | Add the page's URL to Website access, or turn the restriction off |
PERMISSION_DENIED | Turn the permission on and build again; if the user refused, explain and offer the settings |
UNSUPPORTED_PLATFORM | The method is not available on this platform (for example Sign in with Apple on Android) |
INVALID_PARAMS | Fix the parameter named in details.field |
BUSY | Wait until the previous call of the same plugin finishes |
TIMEOUT | Try again; check the device's connection for network-based features |
Works on Android but not on iOS (or the reverse)
- The method may be platform-specific and answer
UNSUPPORTED_PLATFORM. - Plugins and permissions are compiled per platform: build the other platform again after turning them on.
- On iOS, the user may have refused the permission.
Debugging tips
- Log every result:
console.log(JSON.stringify(result)). - Use
await wapp.plugins.list()to see which plugins this build has and why others are off. - Use each plugin's test page to rule out problems in your own code; see Native plugins overview.