exponent-server-sdk-php icon indicating copy to clipboard operation
exponent-server-sdk-php copied to clipboard

Working locally and giving 500 error on the server

Open azaderdogan opened this issue 3 years ago • 1 comments

Hello. We are using this repo in our project. There is no problem in local tests, but when we perform it on the server, we get a 500 error. Our server has ssl. As far as we guessed, exec_curl is not working. what do you think we should do?

azaderdogan avatar Jun 04 '22 22:06 azaderdogan

Hello. We are using this repo in our project. There is no problem in local tests, but when we perform it on the server, we get a 500 error. Our server has ssl. As far as we guessed, exec_curl is not working. what do you think we should do?

How many notifications are you sending together? If it's more than 100, that is most likely the underlying error.

I've experienced it, I was sending notifications to just few users in local tests, but in production, I was sending notification to over a 1000 user.

josephajibodu avatar Jun 20 '22 20:06 josephajibodu

Please kindly help as I'm getting 500 errors as well.

I don't know if I'm implementing it well for my own case, because this is my first time implementing the push notification. And I'm using the online server for it. Here is my code so far:

`<?php require_once DIR.'/vendor/autoload.php';

	$channelName = 'video_alert';
	$recipient= 'ExponentPushToken[AAAAnrlyESE:APA91bHYeOkFi5MlUB9eitKn1yEuReJ1dNrRSnlMob0lcBLAjoanDaAIposGTBWQD164CGMV8F0hriJtsXuaFPdoKxEpjtrnXshoxlZQmxdlrCjP_F5TyRToNGP43YqwahCd6XYhKvwX]'; // This is my server key from Firebase Cloud Messaging

	
	// You can quickly bootup an expo instance
	$expo = \ExponentPhpSDK\Expo::normalSetup();
	
	// Subscribe the recipient to the server
	$expo->subscribe($channelName, $recipient);
	
	// Build the notification data
	$notification = ['body' => 'Catch new latest content ('.$movie_title.') today!', 'data' => json_encode(array('Title' => 'Watch Movies'))];
	
	// Notify an interest with a notification
	$expo->notify([$channelName], $notification);

?>`

I'm actually trying to upload content to the server and then, the users, who have downloaded our app, should get the push notifications whenever the content is posted successfully.

Tosey avatar Sep 09 '22 15:09 Tosey

Check your error log and show the error message

josephajibodu avatar Sep 09 '22 18:09 josephajibodu

Check your error log and show the error message

This is the error i'm getting:

PHP Fatal error: Uncaught Error: Class "ExponentPhpSDK\Expo" not found in C:\wamp64\www\doobuxx.com\video-upload\add-video.php:107

It seems the class is not found in the vendor folder require_once DIR.'/vendor/autoload.php'; Or what could be wrong here?

Tosey avatar Sep 10 '22 10:09 Tosey

Are the packages installed on your server. Or check to be sure you have vendors folder in your project root.

Run composer install in your server terminal if you can. And if you can't, copy your vendors folder from your localhost to your server.

josephajibodu avatar Sep 10 '22 12:09 josephajibodu

Are the packages installed on your server. Or check to be sure you have vendors folder in your project root.

Run composer install in your server terminal if you can. And if you can't, copy your vendors folder from your localhost to your server.

Yes thank you. I have fixed it. So there is no error in the log again when i upload content to the server. But the notification is still not sending. I'm using expo Go app for now. Does it send notifications on Expo Go app?

If not, then i will have to build my project, install the apk and test it to see if it will send.

Tosey avatar Sep 10 '22 14:09 Tosey