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

Error when sending a push notification through the Docker Library #7

Closed
kdimitrov opened this issue Jan 31, 2017 · 10 comments
Closed
Labels

Comments

@kdimitrov
Copy link

kdimitrov commented Jan 31, 2017

Hey there,

First of all thank you for the library.
I've been doing some tests and because I couldn't get it to work on Amazon Linux AWS I deployed your docker machine but I still get an error.

The error is:
Undefined offset: 1 in vendor/edamov/pushok/src/Client.php on line 95

I've been checking what actually causes the error and it seems that this line:

$result = curl_multi_getcontent($handle);

returns and empty response.

My team id and certificate combination is correct.
If you can give me a heads up or any guidance how to fix this I will be more than grateful.

Thanks in advance.

@edamov
Copy link
Owner

edamov commented Jan 31, 2017

Hi @kdimitrov,

It's the hard question for me.
You should try different environments (dev and prod). If the response still is empty, try to make response with incorrect TEAM ID, for example. Are you get an error from APNS? Or is reponse still empty?

@kdimitrov
Copy link
Author

Hey Arthur,

I tried to make the same request with wrong bundle ID and wrong team id but the error is persisting even with your docker image.

I also tried to send a push notification using the node.js app in this example:

https://eladnava.com/send-push-notifications-to-ios-devices-using-xcode-8-and-swift-3/

And it worked, which means that my details are correct. If you can give me any further advice I would be thankful.

@edamov
Copy link
Owner

edamov commented Jan 31, 2017

Are there any errors or just empty response?

@kdimitrov
Copy link
Author

kdimitrov commented Jan 31, 2017

I don't see any errors except for the main one:

Fuel\Core\PhpErrorException [ Notice ]:
Undefined offset: 1

/Users/l2l/Developer/Server/fuel/vendor/edamov/pushok/src/Client.php @ line 95

90        $responseCollection = [];
91        foreach ($handles as $handle) {
92            curl_multi_remove_handle($mh, $handle);
93            $result = curl_multi_getcontent($handle);
94
95            list($headers, $body) = explode("\r\n\r\n", $result, 2);
96            $statusCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
97            $responseCollection[] = new Response($statusCode, $headers, $body);
98        }
99
100        curl_multi_close($mh);
Backtrace

COREPATH/bootstrap.php @ line 103
/Users/l2l/Developer/Server/fuel/vendor/edamov/pushok/src/Client.php @ line 95
APPPATH/classes/lib/push/notifications.php @ line 68
APPPATH/classes/controller/api/base.php @ line 507
COREPATH/base56.php @ line 37
COREPATH/classes/controller/rest.php @ line 153
COREPATH/classes/request.php @ line 454
DOCROOT/index.php @ line 53```

@edamov
Copy link
Owner

edamov commented Jan 31, 2017

Ok, I need some time to investigate this problem

@edamov edamov added the bug label Jan 31, 2017
@kdimitrov
Copy link
Author

Thanks for your input. I highly appreciate it. If you need any other details from me just let me know.

@edamov
Copy link
Owner

edamov commented Jan 31, 2017

Seems I found the reason of the bug. I think it is the same error with my docker image and with your environment.
As you can see in requirements the lib-curl should be compiled with http/2 support. My docker image wasn't compiled correctly, so it doesn't have http/2 support.
I'll try to fix docker this week.
You can follow this instruction to enable http/2 support in your environment.

@kdimitrov
Copy link
Author

Thanks for the heads up. I noticed that but unfortunately I am not able to install a stable version of lib-curl that is compiled with http/2 support on the distribution where my code is deployed (Amazon AWS Linux). Do you know if only lib-curl should be compiled with http/2 support or apache and php must be recompiled with that option as well ?

Please let me know when the docker image is fixed.

@edamov
Copy link
Owner

edamov commented Feb 2, 2017

For me only recompiling lib-curl was helpful.

@edamov
Copy link
Owner

edamov commented Apr 8, 2017

I created new docker image with HTTP\2 support. So now it should work correct.

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

No branches or pull requests

2 participants