krakenjs / post-robot

Cross domain post-messaging on the client side using a simple listener/client pattern.
Apache License 2.0
741 stars 92 forks source link

React Native webview #93

Open codingedgar opened 3 years ago

codingedgar commented 3 years ago

Hi there!

It seems PayPal is using this library (or react-native web view), I integrated successfully PayPal Smart Payment Buttons in old versions of React Native Webview, but it fails in newer versions with the following error:

Error: Send request message failed for onInit() in https://www.sandbox.paypal.com

All post-robot messaging strategies failed:

0. The string did not match the expected pattern.
postMessage@[native code]
postrobot_post_message@

Do you guys have any idea what could be causing this in a webview?

Related: https://github.com/react-native-webview/react-native-webview/issues/1928

gregjopa commented 3 years ago

Hi @codingedgar, does this problem also happen in production? Or is it only happening when using a sandbox client-id?

We recently turned on this namespace feature with the paypal js sdk in sandbox only a few days ago which may be related.

codingedgar commented 3 years ago

I've only tried it with the sandbox.

Should I do something with the namespace? What does it mean?

Also, it works fine in the older versions of react native webview, just not the latest.

codingedgar commented 3 years ago

Btw: I used the production clientId and URL and still get the same error

onurio commented 2 years ago

@codingedgar were you able to make the WebView work? Currently trying to make an app using zoid render inside a WebView, having issues with the postMessage.

ericyliu commented 1 year ago

i am having the same error:

[Error] Error: Send request message failed for Be() in https://www.paypal.com

All post-robot messaging strategies failed:

0. The string did not match the expected pattern.
postMessage@[native code]
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:90101
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:84206
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:16634
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:15698
A@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:14954
_@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:14995
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:19293
init@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:128726
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:130006
anonymous::memoized@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:30780
Qo@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:131836
ei@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:132622
anonymous::memoized@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:30780
jl@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:322135
o@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:324539
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:324821
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:325050
t@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:161
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:942
global code@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:951

1. Global messaging not needed for browser
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:90296
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:84206
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:16634
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:15698
A@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:14954
_@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:14995
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:19293
init@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:128726
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:130006
anonymous::memoized@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:30780
Qo@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:131836
ei@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:132622
anonymous::memoized@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:30780
jl@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:322135
o@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:324539
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:324821
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:325050
t@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:161
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:942
global code@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:951
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:84272
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:16634
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:15698
A@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:14954
_@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:14995
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:19293
init@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:128726
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:130006
anonymous::memoized@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:30780
Qo@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:131836
ei@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:132622
anonymous::memoized@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:30780
jl@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:322135
o@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:324539
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:324821
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:325050
t@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:161
https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:942
global code@https://www.paypal.com/sdk/js?client-id=ARp1YeVEY0G6b7ZMvEzaxaPzZw-I0sZ5LGJLcM53pd69putwa2DWYpDeFyKcphkyFmGvgVubRtPoY7DH&currency=USD&components=buttons:2:951
    (anonymous function) (js:2:16168)