pusher / pusher-websocket-react-native

React Native official Pusher SDK
MIT License
61 stars 52 forks source link

java.lang.NullPointerException #83

Closed ahmetserefoglu closed 1 year ago

ahmetserefoglu commented 1 year ago

java.lang.NullPointerException FATAL EXCEPTION: mqt_native_modules Process: com.dynapps.docall, PID: 20440 java.lang.NullPointerException at com.pusherwebsocketreactnative.PusherWebsocketReactNativeModule.onAuthorizer(PusherWebsocketReactNativeModule.kt:158) at java.lang.reflect.Method.invoke(Native Method) at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188) at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27) at android.os.Looper.loop(Looper.java:154) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228) at java.lang.Thread.run(Thread.java:761)

Can you help me ?

benw-pusher commented 1 year ago

Could you share the init code and the onAuthoriser you have specified? You can redact any urls and credentials that need to be removed.

ahmetserefoglu commented 1 year ago

@benw-pusher of course,

onAuthorizer: async (channelName, socketId) => { try { const response = await axios .create() .post(url + 'broadcasting/auth', { socket_id: socketId, channel_name: channelName, headers: { Authorization: Bearer ${session?.userToken}, }, });

      return response?.data;
    } catch (e) {
      console.log(e);
      return false;
    }
  },
benw-pusher commented 1 year ago

Do you know if there is a particular event that causes this error? For example on subscribe to a channel, after disconnect, when receiving an event?

benw-pusher commented 1 year ago

We haven't been able to replicate this and haven't had a response to our latest post so will close this. If you need further support please get in touch via support.pusher.com.