Laravel 5.4 inconsistent no response and no error in logs2019 Community Moderator ElectionHow do I get PHP errors to display?How do I set up middleware in laravelAuth::user() returns nullHow do I use the / (index) route twice for both logged in and logged out?Laravel 5.2 - access authenticated user in route bindingLaravel 5.4 redirect to specific page if user is not authenticated using middlewareLaravel 5.4 Auth API routeLaravel 5.6 - How to get auth()->user() or $response->user() in api controller?Laravel: how to get current user in public routeLaravel 5.6.28: Auth Middleware redirects to Login (handle not called)
Too soon for a plot twist?
Professor forcing me to attend a conference, I can't afford even with 50% funding
After Brexit, will the EU recognize British passports that are valid for more than ten years?
Why does a car's steering wheel get lighter with increasing speed
Is it appropriate to ask a former professor to order a library book for me through ILL?
Short story about cities being connected by a conveyor belt
What does it take to become a wilderness skills guide as a business?
Interpretation of linear regression interaction term plot
Sort array by month and year
Where is the License file location for Identity Server in Sitecore 9.1?
Limpar string com Regex
Is this Paypal Github SDK reference really a dangerous site?
How can I have x-axis ticks that show ticks scaled in powers of ten?
Are small insurances worth it?
Should I file my taxes? No income, unemployed, but paid 2k in student loan interest
Cycles on the torus
Will the concrete slab in a partially heated shed conduct a lot of heat to the unconditioned area?
Should I apply for my boss's promotion?
Inorganic chemistry handbook with reaction lists
Why do we call complex numbers “numbers” but we don’t consider 2-vectors numbers?
Can I negotiate a patent idea for a raise, under French law?
Was it really inappropriate to write a pull request for the company I interviewed with?
Issue with units for a rocket nozzle throat area problem
Generating a list with duplicate entries
Laravel 5.4 inconsistent no response and no error in logs
2019 Community Moderator ElectionHow do I get PHP errors to display?How do I set up middleware in laravelAuth::user() returns nullHow do I use the / (index) route twice for both logged in and logged out?Laravel 5.2 - access authenticated user in route bindingLaravel 5.4 redirect to specific page if user is not authenticated using middlewareLaravel 5.4 Auth API routeLaravel 5.6 - How to get auth()->user() or $response->user() in api controller?Laravel: how to get current user in public routeLaravel 5.6.28: Auth Middleware redirects to Login (handle not called)
IMPORTANT EDIT: I cannot seem to be able to replicate the issue on Chrome, it is intermittent on Firefox (about 50/50). And is happening even more on Edge (about 70/30).
I have checked other similar questions but they do not resolve the issue.
I am using Angular JS with Laravel 5.4, sending a GET
request and it is sometimes succeeding and sometimes failing. When I say failing I mean I am literally getting nothing back. I am getting no error and I can confirm laravel.log file is logging other errors but nothing for this.
In my console I have two examples that were done one after the other.
The request is called get-user-roles
and the function is called at UserController@getUserRoles
Failed:
Succeeded:
You can see in the second one I am getting blank data back as expected.
Here is my web.php
in /routes
Route::group(
[
'middleware' => ['cors', 'switchdb'],
], function ()
// auth
Route::resource('authenticate', 'AuthenticateController', ['only' => ['index']]);
Route::post('authenticate', 'AuthenticateController@authenticate');
Route::group(
[
'middleware' => ['jwt.auth'],
], function ()
Route::get('get-user-roles', 'UserController@getUserRoles');
);
Route::group(
[
'middleware' => ['jwt.auth', 'is-not-customer'],
], function ()
// more functions
);
);
Here is my controller UserController
<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
use AppUser;
use AppRole;
use AppHttpRequestsPublishUserRequest;
use AppHttpRequestsChangePasswordRequest;
use Auth;
class UserController extends Controller
protected $user;
public function __construct()
$this->user = new User();
public function getUserRoles()
try
$roles = $this->user->getPagesForRoles(Auth::user()->id);
foreach ($roles as $key => $role)
if ($role['hasRole'] == 0)
unset($roles[$key]);
return response()->json([
'data' => $roles
], 200
);
catch (Exception $e)
return response()->json([
'message' => $e->getMessage(),
'line' => $e->getLine()
], 400
);
And my model code (AppUser)
for obtaining the roles...
public function getPagesForRoles($userID = false)
if (!$userID)
$userID = Auth::user()->id;
$pagesForRoles = $this->role->getRoles();
// check if user has role or not and add it to data
if ($userID != 0)
foreach ($pagesForRoles as $key => &$role)
$hasRole = DB::table('user_roles')
->where('role_id', '=', $key)
->where('user_id', '=', $userID)
->get();
if (isset($hasRole[0]))
if($key == 'admin')
$hasAdminRole = 1;
$role['hasRole'] = 1;
else
$role['hasRole'] = 0;
if($userID == 1
getRoles()
that is called in the model code simply returns a hardcoded array.
EDIT: Its worth mentioning that when I do die('test');
in my controller function I do get a response every time.
php angularjs laravel laravel-5 laravel-5.4
add a comment |
IMPORTANT EDIT: I cannot seem to be able to replicate the issue on Chrome, it is intermittent on Firefox (about 50/50). And is happening even more on Edge (about 70/30).
I have checked other similar questions but they do not resolve the issue.
I am using Angular JS with Laravel 5.4, sending a GET
request and it is sometimes succeeding and sometimes failing. When I say failing I mean I am literally getting nothing back. I am getting no error and I can confirm laravel.log file is logging other errors but nothing for this.
In my console I have two examples that were done one after the other.
The request is called get-user-roles
and the function is called at UserController@getUserRoles
Failed:
Succeeded:
You can see in the second one I am getting blank data back as expected.
Here is my web.php
in /routes
Route::group(
[
'middleware' => ['cors', 'switchdb'],
], function ()
// auth
Route::resource('authenticate', 'AuthenticateController', ['only' => ['index']]);
Route::post('authenticate', 'AuthenticateController@authenticate');
Route::group(
[
'middleware' => ['jwt.auth'],
], function ()
Route::get('get-user-roles', 'UserController@getUserRoles');
);
Route::group(
[
'middleware' => ['jwt.auth', 'is-not-customer'],
], function ()
// more functions
);
);
Here is my controller UserController
<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
use AppUser;
use AppRole;
use AppHttpRequestsPublishUserRequest;
use AppHttpRequestsChangePasswordRequest;
use Auth;
class UserController extends Controller
protected $user;
public function __construct()
$this->user = new User();
public function getUserRoles()
try
$roles = $this->user->getPagesForRoles(Auth::user()->id);
foreach ($roles as $key => $role)
if ($role['hasRole'] == 0)
unset($roles[$key]);
return response()->json([
'data' => $roles
], 200
);
catch (Exception $e)
return response()->json([
'message' => $e->getMessage(),
'line' => $e->getLine()
], 400
);
And my model code (AppUser)
for obtaining the roles...
public function getPagesForRoles($userID = false)
if (!$userID)
$userID = Auth::user()->id;
$pagesForRoles = $this->role->getRoles();
// check if user has role or not and add it to data
if ($userID != 0)
foreach ($pagesForRoles as $key => &$role)
$hasRole = DB::table('user_roles')
->where('role_id', '=', $key)
->where('user_id', '=', $userID)
->get();
if (isset($hasRole[0]))
if($key == 'admin')
$hasAdminRole = 1;
$role['hasRole'] = 1;
else
$role['hasRole'] = 0;
if($userID == 1
getRoles()
that is called in the model code simply returns a hardcoded array.
EDIT: Its worth mentioning that when I do die('test');
in my controller function I do get a response every time.
php angularjs laravel laravel-5 laravel-5.4
Have you looked into server and Laravel logs? If it’s intermittent, it might be due to throttling (which you don’t have) or a caching issue.
– Daniel Protopopov
Oct 16 '18 at 19:27
1
Ill take a look at the server logs. Actually even writing out the question has helped in really realising there isnt anything wrong in the code.
– Adrian
Oct 17 '18 at 9:18
The screenshot for the failed call seems to indicate that the request hasn't finished processing. There is no response error code like200
or otherwise. Are you sure the call has finished?
– Niraj Shah
Oct 17 '18 at 13:22
Pretty sure alright, it sits there indefinitely, but yes it seems like what you're describing is whats happening.
– Adrian
Oct 17 '18 at 14:41
This isnt happening in Chrome for some reason, only Firefox and Edge.
– Adrian
Oct 18 '18 at 14:39
add a comment |
IMPORTANT EDIT: I cannot seem to be able to replicate the issue on Chrome, it is intermittent on Firefox (about 50/50). And is happening even more on Edge (about 70/30).
I have checked other similar questions but they do not resolve the issue.
I am using Angular JS with Laravel 5.4, sending a GET
request and it is sometimes succeeding and sometimes failing. When I say failing I mean I am literally getting nothing back. I am getting no error and I can confirm laravel.log file is logging other errors but nothing for this.
In my console I have two examples that were done one after the other.
The request is called get-user-roles
and the function is called at UserController@getUserRoles
Failed:
Succeeded:
You can see in the second one I am getting blank data back as expected.
Here is my web.php
in /routes
Route::group(
[
'middleware' => ['cors', 'switchdb'],
], function ()
// auth
Route::resource('authenticate', 'AuthenticateController', ['only' => ['index']]);
Route::post('authenticate', 'AuthenticateController@authenticate');
Route::group(
[
'middleware' => ['jwt.auth'],
], function ()
Route::get('get-user-roles', 'UserController@getUserRoles');
);
Route::group(
[
'middleware' => ['jwt.auth', 'is-not-customer'],
], function ()
// more functions
);
);
Here is my controller UserController
<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
use AppUser;
use AppRole;
use AppHttpRequestsPublishUserRequest;
use AppHttpRequestsChangePasswordRequest;
use Auth;
class UserController extends Controller
protected $user;
public function __construct()
$this->user = new User();
public function getUserRoles()
try
$roles = $this->user->getPagesForRoles(Auth::user()->id);
foreach ($roles as $key => $role)
if ($role['hasRole'] == 0)
unset($roles[$key]);
return response()->json([
'data' => $roles
], 200
);
catch (Exception $e)
return response()->json([
'message' => $e->getMessage(),
'line' => $e->getLine()
], 400
);
And my model code (AppUser)
for obtaining the roles...
public function getPagesForRoles($userID = false)
if (!$userID)
$userID = Auth::user()->id;
$pagesForRoles = $this->role->getRoles();
// check if user has role or not and add it to data
if ($userID != 0)
foreach ($pagesForRoles as $key => &$role)
$hasRole = DB::table('user_roles')
->where('role_id', '=', $key)
->where('user_id', '=', $userID)
->get();
if (isset($hasRole[0]))
if($key == 'admin')
$hasAdminRole = 1;
$role['hasRole'] = 1;
else
$role['hasRole'] = 0;
if($userID == 1
getRoles()
that is called in the model code simply returns a hardcoded array.
EDIT: Its worth mentioning that when I do die('test');
in my controller function I do get a response every time.
php angularjs laravel laravel-5 laravel-5.4
IMPORTANT EDIT: I cannot seem to be able to replicate the issue on Chrome, it is intermittent on Firefox (about 50/50). And is happening even more on Edge (about 70/30).
I have checked other similar questions but they do not resolve the issue.
I am using Angular JS with Laravel 5.4, sending a GET
request and it is sometimes succeeding and sometimes failing. When I say failing I mean I am literally getting nothing back. I am getting no error and I can confirm laravel.log file is logging other errors but nothing for this.
In my console I have two examples that were done one after the other.
The request is called get-user-roles
and the function is called at UserController@getUserRoles
Failed:
Succeeded:
You can see in the second one I am getting blank data back as expected.
Here is my web.php
in /routes
Route::group(
[
'middleware' => ['cors', 'switchdb'],
], function ()
// auth
Route::resource('authenticate', 'AuthenticateController', ['only' => ['index']]);
Route::post('authenticate', 'AuthenticateController@authenticate');
Route::group(
[
'middleware' => ['jwt.auth'],
], function ()
Route::get('get-user-roles', 'UserController@getUserRoles');
);
Route::group(
[
'middleware' => ['jwt.auth', 'is-not-customer'],
], function ()
// more functions
);
);
Here is my controller UserController
<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
use AppUser;
use AppRole;
use AppHttpRequestsPublishUserRequest;
use AppHttpRequestsChangePasswordRequest;
use Auth;
class UserController extends Controller
protected $user;
public function __construct()
$this->user = new User();
public function getUserRoles()
try
$roles = $this->user->getPagesForRoles(Auth::user()->id);
foreach ($roles as $key => $role)
if ($role['hasRole'] == 0)
unset($roles[$key]);
return response()->json([
'data' => $roles
], 200
);
catch (Exception $e)
return response()->json([
'message' => $e->getMessage(),
'line' => $e->getLine()
], 400
);
And my model code (AppUser)
for obtaining the roles...
public function getPagesForRoles($userID = false)
if (!$userID)
$userID = Auth::user()->id;
$pagesForRoles = $this->role->getRoles();
// check if user has role or not and add it to data
if ($userID != 0)
foreach ($pagesForRoles as $key => &$role)
$hasRole = DB::table('user_roles')
->where('role_id', '=', $key)
->where('user_id', '=', $userID)
->get();
if (isset($hasRole[0]))
if($key == 'admin')
$hasAdminRole = 1;
$role['hasRole'] = 1;
else
$role['hasRole'] = 0;
if($userID == 1
getRoles()
that is called in the model code simply returns a hardcoded array.
EDIT: Its worth mentioning that when I do die('test');
in my controller function I do get a response every time.
php angularjs laravel laravel-5 laravel-5.4
php angularjs laravel laravel-5 laravel-5.4
edited Oct 18 '18 at 16:39
Adrian
asked Oct 16 '18 at 18:53
AdrianAdrian
1,04332574
1,04332574
Have you looked into server and Laravel logs? If it’s intermittent, it might be due to throttling (which you don’t have) or a caching issue.
– Daniel Protopopov
Oct 16 '18 at 19:27
1
Ill take a look at the server logs. Actually even writing out the question has helped in really realising there isnt anything wrong in the code.
– Adrian
Oct 17 '18 at 9:18
The screenshot for the failed call seems to indicate that the request hasn't finished processing. There is no response error code like200
or otherwise. Are you sure the call has finished?
– Niraj Shah
Oct 17 '18 at 13:22
Pretty sure alright, it sits there indefinitely, but yes it seems like what you're describing is whats happening.
– Adrian
Oct 17 '18 at 14:41
This isnt happening in Chrome for some reason, only Firefox and Edge.
– Adrian
Oct 18 '18 at 14:39
add a comment |
Have you looked into server and Laravel logs? If it’s intermittent, it might be due to throttling (which you don’t have) or a caching issue.
– Daniel Protopopov
Oct 16 '18 at 19:27
1
Ill take a look at the server logs. Actually even writing out the question has helped in really realising there isnt anything wrong in the code.
– Adrian
Oct 17 '18 at 9:18
The screenshot for the failed call seems to indicate that the request hasn't finished processing. There is no response error code like200
or otherwise. Are you sure the call has finished?
– Niraj Shah
Oct 17 '18 at 13:22
Pretty sure alright, it sits there indefinitely, but yes it seems like what you're describing is whats happening.
– Adrian
Oct 17 '18 at 14:41
This isnt happening in Chrome for some reason, only Firefox and Edge.
– Adrian
Oct 18 '18 at 14:39
Have you looked into server and Laravel logs? If it’s intermittent, it might be due to throttling (which you don’t have) or a caching issue.
– Daniel Protopopov
Oct 16 '18 at 19:27
Have you looked into server and Laravel logs? If it’s intermittent, it might be due to throttling (which you don’t have) or a caching issue.
– Daniel Protopopov
Oct 16 '18 at 19:27
1
1
Ill take a look at the server logs. Actually even writing out the question has helped in really realising there isnt anything wrong in the code.
– Adrian
Oct 17 '18 at 9:18
Ill take a look at the server logs. Actually even writing out the question has helped in really realising there isnt anything wrong in the code.
– Adrian
Oct 17 '18 at 9:18
The screenshot for the failed call seems to indicate that the request hasn't finished processing. There is no response error code like
200
or otherwise. Are you sure the call has finished?– Niraj Shah
Oct 17 '18 at 13:22
The screenshot for the failed call seems to indicate that the request hasn't finished processing. There is no response error code like
200
or otherwise. Are you sure the call has finished?– Niraj Shah
Oct 17 '18 at 13:22
Pretty sure alright, it sits there indefinitely, but yes it seems like what you're describing is whats happening.
– Adrian
Oct 17 '18 at 14:41
Pretty sure alright, it sits there indefinitely, but yes it seems like what you're describing is whats happening.
– Adrian
Oct 17 '18 at 14:41
This isnt happening in Chrome for some reason, only Firefox and Edge.
– Adrian
Oct 18 '18 at 14:39
This isnt happening in Chrome for some reason, only Firefox and Edge.
– Adrian
Oct 18 '18 at 14:39
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52842199%2flaravel-5-4-inconsistent-no-response-and-no-error-in-logs%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52842199%2flaravel-5-4-inconsistent-no-response-and-no-error-in-logs%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you looked into server and Laravel logs? If it’s intermittent, it might be due to throttling (which you don’t have) or a caching issue.
– Daniel Protopopov
Oct 16 '18 at 19:27
1
Ill take a look at the server logs. Actually even writing out the question has helped in really realising there isnt anything wrong in the code.
– Adrian
Oct 17 '18 at 9:18
The screenshot for the failed call seems to indicate that the request hasn't finished processing. There is no response error code like
200
or otherwise. Are you sure the call has finished?– Niraj Shah
Oct 17 '18 at 13:22
Pretty sure alright, it sits there indefinitely, but yes it seems like what you're describing is whats happening.
– Adrian
Oct 17 '18 at 14:41
This isnt happening in Chrome for some reason, only Firefox and Edge.
– Adrian
Oct 18 '18 at 14:39