Title: Version 1.64 causing Internal Server Error through REST API
Last modified: August 24, 2023

---

# Version 1.64 causing Internal Server Error through REST API

 *  Resolved [Nifty](https://wordpress.org/support/users/niftythree/)
 * (@niftythree)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/version-1-64-causing-internal-server-error-through-rest-api/)
 * Hi Murali,
 * Hope you are well.
 * We’ve tried updating to the latest version of the PNFPB plugin which you have
   recently released (version 1.64), however we have discovered that this version
   stops the JWT REST API endpoint from functioning correctly (provided by the JWT
   Authentication for WP REST API plugin, [https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/](https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/)).
 * After the update, making a call to the **/wp-json/jwt-auth/v1/token **endpoint
   results in an internal server error, as seen in Postman (see [here](https://imgbox.com/T76YqwA0)).
 * The endpoint was functioning correctly before the update. If we revert to the
   previous version of the PNFPB plugin (1.63) the endpoint works correctly again.
 * Looking at the server logs, we can see a list of errors which indicate that a
   function call is failing, as shown below:
 *     ```wp-block-code
       'PHP message: PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function Firebase\\JWT\\JWT::encode(), 2 passed in /public_html/wp-content/plugins/jwt-authentication-for-wp-rest-api/public/class-jwt-auth-public.php on line 154 and at least 3 expected in /public_html/wp-content/plugins/push-notification-for-post-and-buddypress/vendor/firebase/php-jwt/src/JWT.php:193\nStack trace:\n#0 /public_html/wp-content/plugins/jwt-authentication-for-wp-rest-api/public/class-jwt-auth-public.php(154): Firebase\\JWT\\JWT::encode()\n#1
       /public_html/wp-includes/rest-api/class-wp-rest-server.php(1181): Jwt_Auth_Public->generate_token()\n#2
       /public_html/wp-includes/rest-api/class-wp-rest-server.php(1028): WP_REST_Server->respond_to_request()\n#3
       /public_html/wp-includ...'
       ```
   
 * We have reverted our live website to the previous version for now.
 * Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Thread Starter [Nifty](https://wordpress.org/support/users/niftythree/)
 * (@niftythree)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/version-1-64-causing-internal-server-error-through-rest-api/#post-17000027)
 * Hi Murali,
 * We believe we’ve found the problem. The JWT plugin we had was an older version
   where the Firebase files were not updated. Once we update the JWT plugin to a
   newer version and to your plugin’s latest version, everything seems to be OK.
 * We’ll let you know if we still encounter issues when we upgrade our live site.
   Sorry for the trouble.
 * Thanks.
 *  Plugin Author [Murali](https://wordpress.org/support/users/murali-indiacitys/)
 * (@murali-indiacitys)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/version-1-64-causing-internal-server-error-through-rest-api/#post-17000447)
 * Hi
 * Ok no problem. Latest version of Firebase requires oauth authentication to send
   push notification securely based on service account credentials. So i incorporated
   google/apiclient to get authenticate token for push notification, subscribe and
   for unsubscribe from firebase push notification. google/apiclient php package(
   from google) uses below version of php packages. It is only for your information.
   Latest version of Firebase api has more changes differences from previous legacy
   firebase api, i did lot of changes in plugin to incorporate latest version of
   Firebase api, so that we no need to worry in future. Legacy Firebase api will
   be completely removed from June 2024.
 *     ```wp-block-code
       {"name": "google/apiclient","type": "library","description": "Client library for Google APIs","keywords": ["google"],"homepage": "http://developers.google.com/api-client-library/php","license": "Apache-2.0","require": {"php": "^7.4|^8.0","google/auth": "^1.28","google/apiclient-services": "~0.200","firebase/php-jwt": "~6.0","monolog/monolog": "^2.5||^3.0","phpseclib/phpseclib": "^3.0.2","guzzlehttp/guzzle": "~6.5||~7.0","guzzlehttp/psr7": "^1.8.4||^2.2.1"},"require-dev": {"squizlabs/php_codesniffer": "^3.0","symfony/dom-crawler": "~2.1","symfony/css-selector": "~2.1","cache/filesystem-adapter": "^1.1","phpcompatibility/php-compatibility": "^9.2","composer/composer": "^1.10.22","phpspec/prophecy-phpunit": "^2.0","phpunit/phpunit": "^9.5"},
       ```
   
 *  Plugin Author [Murali](https://wordpress.org/support/users/murali-indiacitys/)
 * (@murali-indiacitys)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/version-1-64-causing-internal-server-error-through-rest-api/#post-17003355)
 * Hi
 * Today I have released 1.65 version, one of update in this version is, if site
   is using legacy firebase api version then it will not migrate subscription token
   according to latest version of Firebase api httpv1. Once latest version api is
   enabled in admin then it will migrate token to subscribe to topic using oauth
   token (via google api client using service account as per latest version of Firebase
   api. At present this plugin will work for both legacy api and latest version 
   of firebase api based on admin settings. If you use legacy api then it will function
   as it is without invoking google api client. Legacy firebase api will work until
   June 2024 next year before that please enable latest version api in plugin admin
   settings which uses latest version of Firebase api, it will have different structure
   for android/ios notification. If you have any questions on how to get notification
   fields in mobile app based on latest version firebase api , please contact me,
   it requires slight changes in mobile app code to receive extra fields like link…
 * Thanks
 * Murali
 *  Thread Starter [Nifty](https://wordpress.org/support/users/niftythree/)
 * (@niftythree)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/version-1-64-causing-internal-server-error-through-rest-api/#post-17003835)
 * Hi Murali,
 * Thanks for keeping us updated; we appreciate all of the ongoing work you’re doing.
   We’re currently using legacy API, but will move over to the latest version of
   Firebase API before the deadline.
 * We’ve updated PNFPB today, and noted that if a user has multiple tokens, because
   they’re currently logged on to multiple devices, they will only receive notifications
   for the most recently registered token. For example, if a user logs into our 
   app on their tablet, they’ll receive notifications on their tablet. If they later
   log into our app on their phone, and remain logged in on their tablet, they’ll
   only receive notifications on their phone. Both tokens are still visible in the
   backend of PNFPB.
 * We were previously using version 1.51 of PNFPB, and with that version, users 
   would receive notifications on all devices that had registered tokens.
 * Do you know why this would be?
 * Thanks.
 *  Thread Starter [Nifty](https://wordpress.org/support/users/niftythree/)
 * (@niftythree)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/version-1-64-causing-internal-server-error-through-rest-api/#post-17003960)
 * Hi Murali,
 * Just to add to our above comment; we upgraded to version 1.65, and we’re only
   using the PNFPB REST API for notifications.
 * Thanks.
 *  Plugin Author [Murali](https://wordpress.org/support/users/murali-indiacitys/)
 * (@murali-indiacitys)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/version-1-64-causing-internal-server-error-through-rest-api/#post-17005853)
 * Hi
 * As per your comments, you are using legacy api right? if you are legacy api then
   push notification will be sent based on tokens. I did not modified that logic
   which is selecting tokens, it can select more than one token for same userid.
   If it is latest version httpv1 then push notification will be sent to topic ,
   if user subscribes for push notification then user will be subscribed to default
   topic pnfpbgeneral in firebase and for group notifications it will be corresponding
   groupname in latest version httpv1. For one to one communication (friend request,
   accept, privatemessage ) it will same logic like legacy api based on tokens. 
   Also token will be stored only for our reference in httpv1. Since you are using
   legacy version, there is no change as push notification is sent based on array
   of tokens selected from database. I have analyzed today i did not find problem
   becaused i subscribed in mobile as well as in desktop, i got notifications. Still
   i will look again and i will update you. Thanks Murali
    -  This reply was modified 2 years, 9 months ago by [Murali](https://wordpress.org/support/users/murali-indiacitys/).
 *  Thread Starter [Nifty](https://wordpress.org/support/users/niftythree/)
 * (@niftythree)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/version-1-64-causing-internal-server-error-through-rest-api/#post-17005949)
 * Thanks for looking into this, Murali. 🙂
 * Yes, we are using the legacy API, and notifications for our mobile app are only
   for private messages between two users.
 * We’ve done some further testing today:
    - User logs into mobile app on tablet = receives notifications on tablet.
    - User later logs into mobile app on phone, but remains logged in on tablet 
      = only receives notifications on phone (i.e. the device which has most recently
      registered token).
    - On the backend, admins can see that the user has multiple tokens (one for 
      tablet, and one for phone).
    - Admin deletes phone’s token (i.e. the most recently registered token) = user
      will again start receiving notifications on their tablet.
 * We’ve encountered this situation only on mobile devices through the REST API.
   Are you able to test this through just the REST API for private messages, such
   as with two phones?
 * Thanks.
 *  Plugin Author [Murali](https://wordpress.org/support/users/murali-indiacitys/)
 * (@murali-indiacitys)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/version-1-64-causing-internal-server-error-through-rest-api/#post-17006176)
 * I found problem, I will be releasing new version soon to fix problem related 
   to multiple devices for same user id in private message notifications, friendship
   request/accept notification. 1.66 version will be releasing soon Thanks Murali
 *  Plugin Author [Murali](https://wordpress.org/support/users/murali-indiacitys/)
 * (@murali-indiacitys)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/version-1-64-causing-internal-server-error-through-rest-api/#post-17006193)
 * I have released 1.66 version to fix the problem. As per newer version of Firebase
   api httpv1, push notification can be sent to single token or to a topic(for multiple
   devices). Due to this problem i changed sql query for friendship request/accept,
   private messages to limit to 1, it created problem. Now i removed this limit 
   and included loop for new version httpv1 and for legacy it will use array of 
   deviceids for push notification. Please verify.
    -  This reply was modified 2 years, 9 months ago by [Murali](https://wordpress.org/support/users/murali-indiacitys/).
    -  This reply was modified 2 years, 9 months ago by [Murali](https://wordpress.org/support/users/murali-indiacitys/).
 *  Thread Starter [Nifty](https://wordpress.org/support/users/niftythree/)
 * (@niftythree)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/version-1-64-causing-internal-server-error-through-rest-api/#post-17006302)
 * Hi Murali,
 * We’ve tried this on our test site, and version 1.66 seems to have fixed the issue.
   Thank you very much for looking into this and getting back to us so quickly. 
   We appreciate all of your help. 🙂
 * Thanks again.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Version 1.64 causing Internal Server Error through REST API’ is closed
to new replies.

 * ![](https://ps.w.org/push-notification-for-post-and-buddypress/assets/icon-256x256.
   png?rev=2226921)
 * [Push Notification for Post and BuddyPress](https://wordpress.org/plugins/push-notification-for-post-and-buddypress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/push-notification-for-post-and-buddypress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/push-notification-for-post-and-buddypress/)
 * [Active Topics](https://wordpress.org/support/plugin/push-notification-for-post-and-buddypress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/push-notification-for-post-and-buddypress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/push-notification-for-post-and-buddypress/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [Nifty](https://wordpress.org/support/users/niftythree/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/version-1-64-causing-internal-server-error-through-rest-api/#post-17006302)
 * Status: resolved