Telescope doesn't display any records from the telescope_entries
table, but instead it only shows this:
If we take a look into the browser console, we will see that Telescope frequently sends POST requests to its API, but receives an empty array of entries:
I am sure that there are records in the database, because I can see them using my database viewer:
Also when I run DB::table("telescope_entries")->get()
in Tinker I get the proper records from the database.
For debugging purposes I added lad([$request, $storage]);
before the return statement in the index
method in EntryController
:
public function index(Request $request, EntriesRepository $storage)
{
lad([$request, $storage]); // function comes from lanin/laravel-api-debugger
return response()->json([
'entries' => $storage->get(
$this->entryType(),
EntryQueryOptions::fromRequest($request)
),
'status' => $this->status(),
]);
}
Now when the browser send the request to Telescope's API, it receives the following JSON:
{
"entries": [],
"status": "enabled",
"debug": {
"database": {
"total": 1,
"items": [
{
"connection": "sqlite",
"query": "select * from \"telescope_entries\" where \"type\" = 'request' and \"should_display_on_index\" = '1' order by \"sequence\" desc limit 50;",
"time": 7.68
}
]
},
"cache": {
"hit": {
"keys": [],
"total": 0
},
"miss": {
"keys": [
"telescope:dump-watcher",
"telescope:pause-recording"
],
"total": 2
},
"write": {
"keys": [],
"total": 0
},
"forget": {
"keys": [],
"total": 0
}
},
"profiling": [
{
"event": "request-time",
"time": 0.6450369358062744
}
],
"memory": {
"usage": 16327024,
"peak": 16547112
},
"dump": [
[
{
"attributes": {},
"request": {},
"query": {},
"server": {},
"files": {},
"cookies": {},
"headers": {}
},
{}
]
]
}
}
When I run the SQL statement provided above in my database viewer, I receive the records that I should be receiving:
This issue seems to be database independent. I connected to an external PostgreSQL database as well as to a local SQLite database and the same issue occurred.
I'm stuck with this since I first started with Laravel and literally I can't do anything about it. I posted an issue on Telescope's GitHub but it got closed because "It worked for someone else".
Steps I made to recreate this issue:
DB_CONNECTION
variable in .env
file to sqlite
database.sqlite
in the /database
foldercomposer require laravel/telescope
php artisan telescope:install
php artisan migrate
Also, I'm not in production nor I did anything more than the above. Telescope also doesn't work for me if I use a project created by someone else, but for that person it works.
Any help is appreciated!
The solution to this issue is to run Laravel on Homestead. I'm probably missing a package of some sort, I'm too tired to investigate. I can recommend a tutorial which I used to get it going: