Pushwoosh / pushwoosh-react-native-plugin

Other
57 stars 43 forks source link

Android crash on "reverse_proxy_url" #108

Closed bgneu closed 4 years ago

bgneu commented 4 years ago

On plugin version 6.0.3, "reverse_proxy_url" was added as an option to the Pushwoosh.init step. However, if "reverse_proxy_url" is omitted, as per the documentation, Android will throw an error on the following code:

Plugin: 6.0.3 RN: 0.62.2

Code

Pushwoosh.init({ 
    "pw_appid" : "YOUR_PUSHWOOSH_PROJECT_ID" , 
    "project_number" : "YOUR_GCM_PROJECT_NUMBER" 
});

Error

2020-08-19 19:18:31.521 1713-1967/com.projectName E/unknown:ReactNative: Exception in native call
    com.facebook.react.bridge.NoSuchKeyException: reverse_proxy_url
        at com.facebook.react.bridge.ReadableNativeMap.getNullableValue(SourceFile:123)
        at com.facebook.react.bridge.ReadableNativeMap.getNullableValue(SourceFile:127)
        at com.facebook.react.bridge.ReadableNativeMap.getString(SourceFile:162)
        at com.pushwoosh.reactnativeplugin.PushwooshPlugin.init(SourceFile:87)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(SourceFile:372)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(SourceFile:151)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(SourceFile:27)
        at android.os.Looper.loop(Looper.java:214)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(SourceFile:226)
        at java.lang.Thread.run(Thread.java:919)
bgneu commented 4 years ago

A way around this is to define the reverse_proxy_url as an empty string, as such:

Pushwoosh.init({ 
    "pw_appid" : "YOUR_PUSHWOOSH_PROJECT_ID" , 
    "project_number" : "YOUR_GCM_PROJECT_NUMBER",
    "reverse_proxy_url": "", 
});

If this is the expectation, it should probably be noted in the README.

wfhm commented 4 years ago

@bgneu,

Fixed in 6.0.4.

bgneu commented 4 years ago

@wfhm Thanks for the quick turnaround.