My code in routes.php is as follows:
Route::get('/pull/{key?}', array('as' => 'install', function($key = null) {
if($key == "JfjkGmn7JUIygNHf8jh&ygnfrYub"){
SSH::run(array(
'cd /var/www/',
'git pull https://myusername:mypass#bitbucket.org/mygroup/myrep.git'
));
echo 'Pull from Bitbucket.org is done... Do not forget to migrate though! Click here to continue';
} else {
App::abort(404);
}
}));
But I get the error InvalidArgumentException in RemoteManager.php line 156:
Remote connection [] not defined.. Can anyone tell wme where and when to set a connection? It should be local, so my guess was that I do not need to set it.
In Laravel 5 there is no more SSH. There is a separate package for that - SSH for Laravel 5 so looking at documentation you need to configure connection in config/remote.php. In Laravel 4.2 SSH was built in framework - documentation for SSH in Laravel 4.2
Related
So I am trying to use the SMS (text message) function in Laravel / Twilio - I have a local machine which I tested it on and the credentials and everything works fine- I use the same code on my remote machine (which worked fine yesterday) and today I am getting an error: "Error: Credentials are required to create a Client"
I have triple confirmed the credentials are correct, I have even hard coded them into the code , I have moved them from the env file to config file and still not working - I have retested my local machine and it works still - I have copied the code from local machine (working) to remote machine and still not working - the only difference between the two is I have changed the SMTP settings in the env file (even if I remove this , the problem still exists). I have cleared cache, restarted services.
my .env file
TWILIO_SID=xxxxxxxxxx
TWILIO_TOKEN=xxxxxxxxxxxxxxx
TWILIO_FROM=+1xxxxxxxxxxxxx
my Twiliocontroller:
public function smsSend()
{
$receiverNumber = "+111111111";
$message = "Sup Dude";
try {
$account_sid = getenv("TWILIO_SID");
$auth_token = getenv("TWILIO_TOKEN");
$twilio_number = getenv("TWILIO_FROM");
$client = new Client($account_sid, $auth_token);
$client->messages->create($receiverNumber, [
"from" => $twilio_number,
"body" => $message,
"statusCallback" => "https://webhook.site/xxxxxxxxxxxxxx"
]);
dd('SMS Sent Successfully.');
} catch (Exception $e) {
dd("Error: " . $e->getMessage());
}
}
My web.php
Route::get('/smssend', [TwilioController::class, 'smsSend'])->name('smsSend');
Any help would be greatly appreciated
I'm using Laravel v6.2, passport v9.2. On local host its working perfect creating not even a single issue.
When I deployed code on production server, it started created problem, it's giving error.
I matched, php version is also same on production server. but error is only producing on production not local, while code and every thing is same on both.
I searched and found that I should update passport but for this I also need to update laravel version, for some reason I don't want to update laravel.
Can anyone help me how to solve this problem?
Log:
InvalidArgumentException {#1726
#message: "It was not possible to parse your key, reason: "
#code: 0
#file: "/var/www/quickxi-food/vendor/lcobucci/jwt/src/Signer/OpenSSL.php"
#line: 90
trace: {
/var/www/quickxi-food/vendor/lcobucci/jwt/src/Signer/OpenSSL.php:90 {}
/var/www/quickxi-food/vendor/lcobucci/jwt/src/Signer/OpenSSL.php:47 {}
/var/www/quickxi-food/vendor/lcobucci/jwt/src/Signer/OpenSSL.php:21 {}
/var/www/quickxi-food/vendor/lcobucci/jwt/src/Signer/BaseSigner.php:36 {}
/var/www/quickxi-food/vendor/lcobucci/jwt/src/Builder.php:470 {}
/var/www/quickxi-food/vendor/lcobucci/jwt/src/Builder.php:450 {}
/var/www/quickxi-food/vendor/league/oauth2-server/src/Entities/Traits/AccessTokenTrait.php:53 {}
/var/www/quickxi-food/vendor/league/oauth2-server/src/Entities/Traits/AccessTokenTrait.php:61 {}
/var/www/quickxi-food/vendor/league/oauth2-server/src/ResponseTypes/BearerTokenResponse.php:31 {}
/var/www/quickxi-food/vendor/league/oauth2-server/src/AuthorizationServer.php:202 {}
/var/www/quickxi-food/vendor/laravel/passport/src/PersonalAccessTokenFactory.php:116 {}
/var/www/quickxi-food/vendor/laravel/passport/src/PersonalAccessTokenFactory.php:71 {}
/var/www/quickxi-food/vendor/laravel/passport/src/HasApiTokens.php:67 {}
/var/www/quickxi-food/app/Http/Controllers/ApiController/AuthController.php:64 {
App\Http\Controllers\ApiController\AuthController->login(Request $request, $store = false) …
›
› $token = $user->createToken('SpoonJet')->accessToken;
› $user->token = $token;
}
I found my solution, in my case it was user permissions problem on production server. If someone of you is facing same issue, you may apply this solution or in your case can be different solution.
I am trying to install Prestashop on my local machine
Using ubuntu 18.04, php 7.2, mysql 5.6, apache 2.4
I have cloned from their github repo, checkouted to branch 1.7.6.x, installed composer dependencies and made a symbolic link to the code directory from my /var/www/html (didn't want to bother creating a vhost)
Opened chromium to http://127.0.0.1/prestashop/install-dev/index.php
Proceeded with all steps, with correct mysql settings, directory permission settings, left the language to English (English)
But during the Store Installation step, when "Installing addons modules", it fails with a curl error like this:
file_get_contents_curl failed to download http://i18n.prestashop.com/translations/1.7.6.7/en-US/en-US.zip : (error code 28) Operation timed out after 5001 milliseconds with 221832 out of 516048 bytes received
I also have the following info in the Request tab of my inspector:
It's calling http://127.0.0.1/prestashop/install-dev/index.php?installModulesAddons=true&_=1596718771175 with status_code 200
I have the following as response body in there:
{
"success":false,
"message":"file_get_contents_curl failed to download http:\/\/i18n.prestashop.com\/translations\/1.7.6.7\/en-US\/en-US.zip : (error code 28) Operation timed out after 5001 milliseconds with 221832 out of 516048 bytes received"
}
I checked the file in install-dev/controllers/http/process.php but the code that I think is called just looks like this:
/**
* PROCESS : installModulesAddons
* Install modules from addons
*/
public function processInstallAddonsModules()
{
$this->initializeContext();
if (($module = Tools::getValue('module')) && $id_module = Tools::getValue('id_module')) {
$result = $this->model_install->installModulesAddons(array('name' => $module, 'id_module' => $id_module));
} else {
$result = $this->model_install->installModulesAddons();
}
if (!$result || $this->model_install->getErrors()) {
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
}
$this->session->process_validated = array_merge($this->session->process_validated, array('installModulesAddons' => true));
$this->ajaxJsonAnswer(true);
}
I suspect my faulty internet is to blame, but is there a workaround to increase the curl timeout?
Comment the code lines like this:
I am trying to connect my app to facebook login with Laravel and socialite package.But i don't know why facebook show me this error. I searched internet but i couldn't find anything .How can i fix this error ?
I thought that if i make my connection with https it will work but after making https again error appears.
My code in laravel:
web.php
Route::get('login/{provider}', 'SocialController#redirect');
Route::get('login/{provider}/callback','SocialController#Callback');
SocialController.php
public function redirect($provider)
{
return Socialite::driver($provider)->redirect();
}
public function Callback($provider){
$userSocial = Socialite::driver($provider)->stateless()->user();
$users = User::where(['email' => $userSocial->getEmail()])->first();
if($users){
Auth::login($users);
return redirect('/');
}else{$user = User::create([
'username' => $userSocial->getName(),
'email' => $userSocial->getEmail(),
'provider_id' => $userSocial->getId(),
'provider' => $provider,
]);
return redirect()->route('home');
}
}
You can do "Create Test App" and replace your App ID and Secret using the test app.
The simple answer is - Facebook will send sensitive data to provided redirect_uri, so it is ensuring this connection is private, by forcing you to use valid SSL.
As long as you do not setup a valid domain with proper certificate, Facebook won't let you use production API.
It looks like time expiration. I've just created another Facebook app and it works without that error.
You can use ngrok to make your localthost https.
download and run ngrok.exe.
Then run command ngrok.exe http {port}. In most cases, it will be 8000.
In case of angular : try to serve your app in secured socket layer true mode as Facebook is detecting insecure connection
Use the following command:
ng serve --ssl true
When using sailsjs v0.10.3 with Redis To Go for session storage, req.session is always undefined.
It is undefined when I deploy both locally and to Heroku. req.session is correctly defined when I use the default memory adapter.
I created a sailsjs app:
sails new testapp
sails generate api test testSet testGet
Installed connect-redis v1.4.7:
npm install connect-redis#~1.4.7
Set the configuration in config/session.js:
adapter: 'redis',
host: 'hoki.redistogo.com',
port: 10015,
db: 'redistogo',
pass: '88819aa089d3dd86235f9fad4cb92e48'
Set the configuration in config/socket.js:
adapter: 'redis',
host: 'hoki.redistogo.com',
port: 10015,
db: 'redistogo',
pass: '88819aa089d3dd86235f9fad4cb92e48'
Created some controller actions which get and set a session value:
UserController.js
testSet: function (req, res) {
req.session.testVar = "I am the test var!";
return res.ok();
},
testGet: function (req, res) {
return res.json({
testVar: req.session.testVar
});
}
And finally deployed to Heroku:
git init
git add .
git commit -m "Initial commit"
heroku create
heroku addons:add redistogo
git push heroku master
git
This is the error:
error: Sending 500 ("Server Error") response:
TypeError: Cannot set property 'testVar' of undefined
at module.exports.testSet (/app/api/controllers/TestController.js:46:25)
It seems like this simple example should work.
Here is a repo of the example above:
https://github.com/derekbasch/sailsjs-redistogo-testapp
Does anyone know what I am doing wrong?
UPDATE:
I tried using the MemoryStore adapter on Heroku to get/set a session variable. That failed with undefined also. It works locally. Now I am even more confused.
We are using rediscloud (sails app on heroku) and the db property is set to 0. Could this be the problem?
Also, you should parse the URL provided by heroku via en env variables. This is what we use (coffeescript):
parseRedisUrl = ( url ) ->
parsed = require( 'url' ).parse( url )
password = (parsed.auth || '').split( ':' )[1]
hostname: parsed.hostname
port: parsed.port
password: password
redis = parseRedisUrl( process.env.REDISCLOUD_URL || "redis://localhost:6379" )
module.exports.session =
secret: '...'
adapter: 'redis'
host: redis.hostname
port: redis.port
pass: redis.password
db: 0
ttl: 60 * 60 * 24