Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got ErrorException with message 'Subscription should have a content encoding' #163

Open
yoviprasetyo opened this issue Jun 24, 2021 · 2 comments

Comments

@yoviprasetyo
Copy link

Hi,

I develop Laravel App with your packages.

This is my route

Route::post('/save-subscription', 'NotificationController@subscribe')->name('subscription.save');

That route is to save the JSON
I just save the endpoint and don't care for the rest.
I use $user->updatePushSubscription($request->endpoint); to save it. Saved to DB.

But, when I try to notify the User, I got this error.

ErrorException with message 'Subscription should have a content encoding'

I ever see your code that the available value is aesgcm and aes128gcm. But it only return null and no notification occured.

How to solve this error?

@imrodrigoalves
Copy link

Hey,

Have been facing the same issue? Any luck?

@imrodrigoalves
Copy link

imrodrigoalves commented Oct 26, 2022

Okay, small update.

There's a bug that will not apply the default value "aesgcm" if not provided.

To by-pass this you can:

  1. Implement your own version of the Subscription class that applies the value correctly
  2. Send always the value "aesgcm" when updating the subscription
auth('api')->user()->updatePushSubscription($sub['endpoint'], null, null, "aesgcm");

I don't think this looks good unless you're on PHP 8.x and can make use of named parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants