shpasser / GaeSupportL5

Google App Engine Support package for Laravel 5
MIT License
160 stars 27 forks source link

Issue while using Socialite #28

Closed christownsend closed 9 years ago

christownsend commented 9 years ago

I have been trying to migrate a Laravel 5.1 app to Google App Engine and have been trying to use your package. I have got this far and I am now struggling to get this to work.

My view displays but I get an error on the page which is n Filesystem.php line 81 at HandleExceptions->handleError('2', 'file_put_contents(): Exclusive locks may only be set for regular files', '/base/data/home/apps/s~test-unipart/1.386405709774148110/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', '81', array('path' => 'gs://test-unipart.appspot.com/storage/framework/sessions/e1dd19bc161877084c1af230408ee313ccd602bf', 'contents' => 'eyJpdiI6ImZGODkxdFgyVFl5bFgxcnZraXZ1MFgrdkFjMU9LUkdWSHNmQ2NhbUVCTU09IiwidmFsdWUiOiIraXByclZrRzliTzlRazVRTGk0dmV4N1FSc29FdmpoeXpnV2tZKzkzSHJxN3lCamNYdGRvYk1lRXY1WnphU0hxWjRLd2g5Nit4ZE1IbUFoVEFUaE82bGc1WU8wZllNT0o2TWNNTzlpVTZhYWY1eWZqXC85cUlqUlUxRW1XK2VGTVhPaXBuRk1SeTZiVFBmRXhKdlBVNmJJekcxWXlFbFJINUlDR2kyRVppc0kxMDdPM1lISG1LZXUzYVwvQTFRdFpBdlNOZkNPNFNWVnpNdVwvRUpmU2lBNFR1S2ZJSlMxS2JrMVlYcEpHbUhhXC9rTVJZMkQzTG1VWXR6MURKbG9qa2YyOTJoXC9HRnhlUHN5M2JUQ2lzSTNVaXMwN1QyMTBQeGdOVGUzY1o1dFVBYmpTNkxlckxYUjF1U1oxVkI4Wk5NeThSQllyekZFbTVUWGhLb1VVK3RWWXVjKzRJcjJicTZJbkRiYUlCUTh3Ykl4dHFweUhjODhvNWFOeUd2RWdGK3k2NCIsIm1hYyI6ImUyMjdmZjg3ZmIwMjkxYzkwOTc2OTQ5M2EyMTRlOGRjMjI0NDIzZTgyZGM4OTM2MjdlMWVhYTE1MWQ4YTFkMzgifQ==', 'lock' => true)) at file_put_contents('gs://test-unipart.appspot.com/storage/framework/sessions/e1dd19bc161877084c1af230408ee313ccd602bf', 'eyJpdiI6ImZGODkxdFgyVFl5bFgxcnZraXZ1MFgrdkFjMU9LUkdWSHNmQ2NhbUVCTU09IiwidmFsdWUiOiIraXByclZrRzliTzlRazVRTGk0dmV4N1FSc29FdmpoeXpnV2tZKzkzSHJxN3lCamNYdGRvYk1lRXY1WnphU0hxWjRLd2g5Nit4ZE1IbUFoVEFUaE82bGc1WU8wZllNT0o2TWNNTzlpVTZhYWY1eWZqXC85cUlqUlUxRW1XK2VGTVhPaXBuRk1SeTZiVFBmRXhKdlBVNmJJekcxWXlFbFJINUlDR2kyRVppc0kxMDdPM1lISG1LZXUzYVwvQTFRdFpBdlNOZkNPNFNWVnpNdVwvRUpmU2lBNFR1S2ZJSlMxS2JrMVlYcEpHbUhhXC9rTVJZMkQzTG1VWXR6MURKbG9qa2YyOTJoXC9HRnhlUHN5M2JUQ2lzSTNVaXMwN1QyMTBQeGdOVGUzY1o1dFVBYmpTNkxlckxYUjF1U1oxVkI4Wk5NeThSQllyekZFbTVUWGhLb1VVK3RWWXVjKzRJcjJicTZJbkRiYUlCUTh3Ykl4dHFweUhjODhvNWFOeUd2RWdGK3k2NCIsIm1hYyI6ImUyMjdmZjg3ZmIwMjkxYzkwOTc2OTQ5M2EyMTRlOGRjMjI0NDIzZTgyZGM4OTM2MjdlMWVhYTE1MWQ4YTFkMzgifQ==', '2') in Filesystem.php line 81

I understand I can not write to the app engine, but how do I resolve this?

Thanks in advance

shpasser commented 9 years ago

Is this issue still relevant? Was it closed by a mistake?

Anyway, the issue you describe can be caused by:

  1. Not copying the generated .env.production file to .env before the deployment.
  2. Using locally generated config cache bootstrap/cache/config.php.

In order to use cached config on GAE you need to generate it using php artisan gae:setup --cache-config your-app-id.

christownsend commented 9 years ago

Apologies, I completed messed this thread up. I have managed to resolve the issue, I have a problem with Guzzle now on Google App Engine but it appears your package is working as it should, Much appreciated!

shpasser commented 9 years ago

As far as I know GAE should support cURL, but I am not sure to which level. If you could describe the way you use Guzzle in your application I might be able to incorporate the needed changes into my package in order to make Guzzle work on GAE(if it does not work already).

christownsend commented 9 years ago

Okay, Well I'm using Socialite in my application. It has been working in production and locally (Not on Google App Engine). It has been requested at this stage to migrate to GAE. I'm making a OAUTH request to Google. The initial process works, it gives the me the google permissions page. One I click accept I get this curl error

cURL error 7: (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in CurlFactory.php line 168 at CurlFactory::createRejection(object(EasyHandle), array('errno' => '7', 'error' => '', 'url' => 'https://accounts.google.com/o/oauth2/token', 'content_type' => null, 'http_code' => '0', 'header_size' => '0', 'request_size' => '0', 'filetime' => '-1', 'ssl_verify_result' => '0', 'redirect_count' => '0', 'total_time' => '0', 'namelookup_time' => '0.058083', 'connect_time' => '0', 'pretransfer_time' => '0', 'size_upload' => '0', 'size_download' => '0', 'speed_download' => '0', 'speed_upload' => '0', 'download_content_length' => '-1', 'upload_content_length' => '-1', 'starttransfer_time' => '0', 'redirect_time' => '0', 'redirect_url' => '', 'primary_ip' => '', 'certinfo' => array(), 'primary_port' => '0', 'local_ip' => '', 'local_port' => '0')) in CurlFactory.php line 132

It looks like the ssl is failing, but not really sure how to sort this out.

christownsend commented 9 years ago

I was trying this in my php.ini file ; enable function that are disabled by default in the App Engine PHP runtime google_app_engine.enable_functions = "php_sapi_name, php_uname, getmypid" google_app_engine.allow_include_gs_buckets = "test-unipart.appspot.com" allow_url_include = 1 extension = "curl.so" google_app_engine.enable_curl_lite = “1” openssl.cafile = /etc/ca-certificates.crt

shpasser commented 9 years ago

Could you please describe the way you use Socialite, so I could try to reproduce the issue on my setup?

christownsend commented 9 years ago

No problem, so I have an opening page where a user clicks a button, this runs a function, which checks to see if there is a code from the request (From Google), if they don't a use socialite to get the user with this command

$this->socialite->driver('google')->user();

This directs them to Google to login. This stage works in GAE as it shows the google app permission screen. Once the permissions are granted, I then run a sequence of checks to see if they are whitelisted and allowed access, and log them in using Laravels authentication class.

I tried dding at the callback, but it doesnt get that far as I get the curl failure to connect error

shpasser commented 9 years ago

I understand that you managed to solve the problem and there is nothing I can add / change to my package in order to make Socialite work better on GAE. Still I noticed that GAE documentation states that only one of the following options can be enabled:

extension = "curl.so"
google_app_engine.enable_curl_lite = “1”

but not both, meaning you can either use cURL or cURL_lite at the same time.