Push Notifications with NC 15 returning 400 "Bad Request"

Nextcloud version: 15.0.0
Operating system and version (eg, Ubuntu 17.04): CentOs 7
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.6
PHP version (eg, 7.1): 7.2

The issue you are facing: All notifications are getting an HTTP response of 400 - Bad Request from push-notifications.nextcloud.com — Thus chats and video calls are not working appropriately as no notifications are ever received.

Is this the first time you’ve seen this error? (Y/N): Yes, this previously worked and has been failing the last few days. The noticed time was at the upgrade to NC 15.

Steps to replicate it:

  1. Send a message or attempt to start a video call

The output of your Nextcloud log in Admin > Logging:

	GuzzleHttp\Exception\ClientException: Client error: `POST https://push-notifications.nextcloud.com/notifications` resulted in a `400 Bad Request` response:

    /var/www/html/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php - line 66:

    GuzzleHttp\Exception\RequestException::create(GuzzleHttp\Psr7\Request {}, "*** sensiti ... *")

    /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 203:

    GuzzleHttp\Middleware::GuzzleHttp\{closure}("*** sensiti ... *")

    /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 156:

    GuzzleHttp\Promise\Promise::callHandler(1, "*** sensiti ... *", [ GuzzleHttp ... l])

    /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/TaskQueue.php - line 47:

    GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}("*** sensiti ... *")

    /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 246:

    GuzzleHttp\Promise\TaskQueue->run(true)

    /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 223:

    GuzzleHttp\Promise\Promise->invokeWaitFn()

    /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 267:

    GuzzleHttp\Promise\Promise->waitIfPending()

    /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 225:

    GuzzleHttp\Promise\Promise->invokeWaitList()

    /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 62:

    GuzzleHttp\Promise\Promise->waitIfPending()

    /var/www/html/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php - line 131:

    GuzzleHttp\Promise\Promise->wait()

    /var/www/html/nextcloud/lib/private/Http/Client/Client.php - line 231:

    GuzzleHttp\Client->request("post", "https://pus ... s", { verify: "/ ... e})

    /var/www/html/nextcloud/apps/notifications/lib/Push.php - line 143:

    OC\Http\Client\Client->post("https://pus ... s", { form_param ... }})

    /var/www/html/nextcloud/apps/notifications/lib/App.php - line 50:

    OCA\Notifications\Push->pushToDevice(55, OC\Notification\Notification {})

    /var/www/html/nextcloud/lib/private/Notification/Manager.php - line 208:

    OCA\Notifications\App->notify(OC\Notification\Notification {})

    /var/www/html/nextcloud/apps/spreed/lib/Chat/Notifier.php - line 91:

    OC\Notification\Manager->notify(OC\Notification\Notification {})

    /var/www/html/nextcloud/apps/spreed/lib/Chat/ChatManager.php - line 125:

    OCA\Spreed\Chat\Notifier->notifyMentionedUsers(OCA\Spreed\Room {}, OC\Comments\Comment {})

    /var/www/html/nextcloud/apps/spreed/lib/Controller/ChatController.php - line 223:

    OCA\Spreed\Chat\ChatManager->sendMessage(OCA\Spreed\Room {}, "users", "bcalde1", "@scalde1 ", DateTime { d ... "})

    /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 166:

    OCA\Spreed\Controller\ChatController->sendMessage("6yu42uj9", "@scalde1 ", "Brittney Calderwood")

    /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 99:

    OC\AppFramework\Http\Dispatcher->executeController(OCA\Spreed\C ... {}, "sendMessage")

    /var/www/html/nextcloud/lib/private/AppFramework/App.php - line 118:

    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Spreed\C ... {}, "sendMessage")

    /var/www/html/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:

    OC\AppFramework\App::main("OCA\\Spreed ... r", "sendMessage", OC\AppFramew ... {}, { apiVersion ... "})

    <<closure>>

    OC\AppFramework\Routing\RouteActionHandler->__invoke({ apiVersion ... "})

    /var/www/html/nextcloud/lib/private/Route/Router.php - line 297:

    call_user_func(OC\AppFramew ... {}, { apiVersion ... "})

    /var/www/html/nextcloud/ocs/v1.php - line 82:

    OC\Route\Router->match("/ocsapp/app ... 9")

    /var/www/html/nextcloud/ocs/v2.php - line 24:

    require_once("/var/www/ht ... p")

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'ocx10pkwxtqg',
  'passwordsalt' => '-omitted-',
  'secret' => '-omitted-',
  'trusted_domains' =>
  array (
    0 => '-omitted-',
  ),
  'datadirectory' => '/data/nextcloud/udata/data',
  'dbtype' => 'mysql',
  'dbname' => '-omitted-',
  'dbhost' => '-omitted-',
  'dbport' => '',
  'mysql.utf8mb4' => true,
  'dbuser' => '-omitted-',
  'dbpassword' => '-omitted-',
  'installed' => true,
  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpsecure' => 'ssl',
  'mail_from_address' => '-omitted-',
  'mail_domain' => '-omitted-',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '-omitted-',
  'mail_smtpport' => '465',
  'mail_smtpname' => '-omitted-',
  'mail_smtppassword' => '-omitted-',
  'version' => '15.0.0.10',
  'theme' => '',
  'loglevel' => 2,
  'maintenance' => false,
  'overwrite.cli.url' => '-omitted-',
  'updater.release.channel' => 'beta',
);

Is there by chance an incompatibility of sorts with NC15 and the notification proxy? I’m at a complete loss.

Thanks in advance for any guidance.

Steven

I have exactly the same error in my setup!

I am using: NC15, nginx/1.15.8, php7.2, ubuntu 18.04.

Any help is highly appreciated :slight_smile:

Very strange… Has to be something with NC15, but I’d think we’d see a heck of a lot more complaints on the boards if it wasn’t an installation specific issue.

Exactly the same error here, everything seem to work fine, the msg sent is received and nottified but in my nextcloud log i get the same error report described in this post.
Im using Apache 2.4 Php 7.2 NC 15.0.0 and latest talk app

Boosting this up a bit - Anyone have any suggestions here?

I saw auth notifications app disabled as part of upgrade 15.0.0 -> 15.0.2. Now approving logins via notifications have stopped working. “Bad request” when hitting approve.

For what it is worth, i resolved this by removing the records from the oc_notifications and
oc_notifications_pushtokens. After dripping and reconnecting the devices it is working. No idea why this occured as a result of the upgrade.

1 Like

I can approve the solution form @scalderwood, it works for me as well! Thank you!

1 Like

i agree same here

1 Like

Hi, there.
I have the same problem and would like to fix it. But I don’t know how to remove those records. You have to fiddle in the mysql-database, don’t you? I don’t like to experiment on that because of my poor knowledge. Can you give me some detailed advice?
Cheers bitzers_cap

OK. I tried do get it work.

mysql
USE nextcloud;
DELETE FROM oc_notifications;
DELETE FROM oc_notifications_pushtokens;
q

Now I don’t get any further errors but I don’t get any notifications either, which I did (sometimes) before.
I also logged out at all devices and logged in again.
Did I miss something?

Cheers bitzers_cap

Yes, I did miss something: I was still logged in via nextcloud app on a smartphone.
After logging out I get notified on a Smartphone (Nextcloud Talk app) without any error belonging to notifications.

(Unfortunately notifications are not delivered as I’m connected via mobile data (server behind router) but only as I’m connected via wifi (server in the same local netwok). (Yes, I have a working turn-server :wink: ). But that’s another story … --> solved: you shouldn’t switch off backgrounddata vor google play services. Now I’m really satisfied!)

In short: @scalderwoods solution works for me as well. No more errors. Thank you!

Cheers bitzers_cap

I had the same problem with one of the Nextcloud Talk users after upgrading Nextcloud from version 14.0.7 to 15.0.5.
The solution for me was to uninstall Nextcloud Talk App from Android phone.
I logged in as the user via browser and deleted Nextcloud Talk sessions under Settings->Security->Devices & Sessions.
Installed Nextcloud Talk App again and logged in. I did not have to delete anything in the Nextcloud database.

I had the same issue, I solved it with both solutions of svankan and scalderwood. But first I needed to disable Batteries optimisations on Android.

Thank you all