16
Views
2
Comments
[Cloud Messaging Plugin (Firebase)] Wrong signature for the event NotificationsHandler.OnNotificationClicked
Question
cloud-messaging-plugin-firebase
Mobile icon
Forge asset by OutSystems
Application Type
Mobile

When a notification is clicked, the event triggered by the cordova plugin contains a diferent payload than the one being assumed by the OutSystems wrapper, within the block "NotificationsHandler" for the action "OnNotificationClicked".

The payload should be a "Notification" and it is being assumed as an "InternalRouteEvent".

It seems like there was a copy & paste from the event action "OnInternalRouteActionClicked" to the event action "OnNotificationClicked".

Can you please review and fix this situation as soon as possible?

Thanks.

Tiago Peres

2024-10-03 06-30-47
Bharathiraja Loganathan

Got it! You’re referring to a known issue with the Cloud Messaging Plugin (Firebase) in OutSystems, where the event signature for OnNotificationClicked is incorrect. Specifically, the event payload expected by the plugin wrapper is wrong—it assumes an InternalRouteEvent instead of a Notification payload, causing the "Wrong signature for the event" error.

Step-by-step solution to fix the Wrong signature for the event NotificationsHandler.OnNotificationClicked:

1. Understand the Issue

  • The OnNotificationClicked event expects a Notification object payload.

  • The plugin's OutSystems wrapper currently expects an InternalRouteEvent payload.

  • This mismatch causes the "wrong signature" error.

2. Locate the Faulty Event Handler

  • Open your OutSystems mobile app project.

  • Go to the NotificationsHandler block or module where the plugin event handlers are implemented.

  • Find the OnNotificationClicked event action.

3. Check the Event Payload Type

  • Inside the OnNotificationClicked event handler, check the parameter type.

  • It is currently set to InternalRouteEvent (or some type that is not matching the actual payload).

  • You need to change it to the correct Notification structure matching Firebase's notification payload.

4. Fix the Event Signature

  • Edit the input parameter of the OnNotificationClicked event action to expect a Notification object, not an InternalRouteEvent.

    Example (pseudo-structure):

    Notification {

      title: Text

      body: Text

      data: Record (optional, with key-value pairs)

    }


  • Adjust the internal logic of the handler if needed to use the correct fields from the Notification payload.

5. Update the JavaScript or Cordova Plugin Wrapper (If Required)

  • In some cases, you may need to update the underlying JavaScript that listens to the Firebase plugin events.

  • Make sure the event payload passed to OutSystems from the Cordova plugin matches the new structure.

6. Test the Fix

  • Rebuild and redeploy your mobile app.

  • Send a test Firebase push notification.

  • Click the notification and check if the OnNotificationClicked event triggers without the signature error.

  • Verify that the notification data is correctly received and handled.

7. Optional: Check for Official Updates

  • Check if there is an updated version of the Cloud Messaging Plugin (Firebase) in OutSystems Forge that already fixes this issue.

  • If an update is available, upgrading might save you manual fixes.

2025-01-10 11-40-52
Pedro Gustavo Bilro

Hey Tiago, thanks for posting this.


From what I analyzed and tested here, the internal client action is meant to receive "InternalRouteEvent", not "Notification", as that is what is returned by the Cordova Plugin. 
I understand this may cause confusion, as the internal type being used is the same as another event, but it is correct.

So when you add a "NotificationClicked" event in your app, you'll receive the "ScreenName" + "ParameterList" from which you can build a deeplink to a specific screen in your app with custom data when clicking on a notification.

References: https://success.outsystems.com/documentation/11/integration_with_external_systems/mobile_plugins/firebase_plugins/firebase_cloud_messaging_plugin_using_server_actions/#manage-the-experience-of-notification-clicks


Hope this helps! Let me know if you have any other questions.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.