Minishlink / web-push-bundle

Bundle around the WebPush library
MIT License
45 stars 10 forks source link

Not all configs are handled #1

Closed andreybrokeit closed 8 years ago

andreybrokeit commented 8 years ago

PHP Fatal error: Uncaught exception 'Symfony\Component\Config\Definition\Exception\InvalidConfigurationException' with message 'Unrecognized option "automatic_padding" under "minishlink_web_push"'

I think automatic_padding is not handled in this bundle.

Minishlink commented 8 years ago

You should update your composer.json because the last release was "major" (ie. changing from 0.x to 1.x). :)

andreybrokeit commented 8 years ago

I don't have to update my composer.json - I installed bundle just yesterday. Your doc says "Here is the default configuration, you may change it in your app/config/config.yml." If you add "automatic_padding" to the config.yml - it throws error "unknown option". If you remove it - it works fine. It's a problem with bundle not the referenced web-push library

Minishlink commented 8 years ago

Can you provide the content of your composer.json?

andreybrokeit commented 8 years ago

I did some shuffling, and managed to pass error for "stability issues" while installing packages. Now I am stuck with mdanter/ecc block. Composer for some reason thinks I do not have GMP installed. However I did install brew php5.6 with GMP and my docker instance also has GMP installed. Frustrating :(

Minishlink commented 8 years ago

It may be installed but not enabled in the php.ini. (note that in some environments there can be several php.ini, one for each version of PHP, one for Apache etc).

andreybrokeit commented 8 years ago

I wish that was the case, I would fix it somehow... but running phpinfo() shows gmp support as enabled :\

Minishlink commented 8 years ago

Are you running phpinfo in the console or on a webpage served by your Apache/nginx/other?

andreybrokeit commented 8 years ago

In web browser, I drop phpinfo() call either on some php file or Symfony debug bar (so server that renders the page). Console would possibly give me local environment. My setup is a little tricky. I am using Docker and composer has its own image too. So I am not sure what a weird relations it has with nginx container and php container :)

Minishlink commented 8 years ago

Ok so the phpinfo() you're seeing is the one on your nginx server, and GMP is correctly enabled on it. However, it seems that you have a different php.ini for the CLI in your setup. That's the only thing I see right now, though I may be wrong. Check in the Docker image maybe? To make sure, run a phpinfo in the console (just as if you were going to use composer).

andreybrokeit commented 8 years ago

end up adding --ignore-system-req flag to composer since I know I have all libraries installed. It worked. It installed all the encryption libs but now for some reason I get back events from google without payload. It always says "title" undefined. I feel like this supposed to be much easier way to implement things. Especially when product/service is developed by Google. disappointed :\

Minishlink commented 8 years ago

What is the code of the "push" event in your service worker? And what is the data you're sending?

andreybrokeit commented 8 years ago

self.addEventListener('push', function(event) { var obj = event.data;

event.waitUntil( self.registration.showNotification(obj.title, { body: obj.body, icon: obj.icon, tag: obj.tag }) );

Data is just an array array('body' => 'blah', 'title' => 'blah', etc) and it's json_encoded. I console logged the object I receive from GCM and it has no data in it. So I am curious why it complains

Minishlink commented 8 years ago

If it's json encoded, then the data should be retrieved like event.data.json(). Feel free to take a look at my usual sw.js.

andreybrokeit commented 8 years ago

I just dump the whole event into console and PushData is empty, along with text() json() and all the goodness. I doubt it's the way it is retrieved :)

andreybrokeit commented 8 years ago

I think u r right, it was a problem with scopes or something. I may be able to get the data out. Console log incorrectly shows data within other objects recursively. I'll let you know! thanks for your help.

andreybrokeit commented 8 years ago

Works. The event.data.json did the trick. Merci from NYC! :)