Skip to content

Queries need a real database connection since v3.14.0 #1778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cweiske opened this issue Apr 9, 2025 · 0 comments · Fixed by #1779
Closed

Queries need a real database connection since v3.14.0 #1778

cweiske opened this issue Apr 9, 2025 · 0 comments · Fixed by #1779

Comments

@cweiske
Copy link
Contributor

cweiske commented Apr 9, 2025

My application collects data not only from MariaDB, but also from ElasticSearch, Drupal (via GraphQL), Microsoft Dynamics CRM and Microsoft PowerAutomate.
Debugbar's query logs are incredible helpful, so I integrated all the adapters into Debugbar's "queries" tab by logging queries by dispatching \Illuminate\Database\Events\QueryExecuted objects. I only needed a small dummy connection class that returned the database and driver names for that to work:
Image


Now I'm upgrading from Laravel 8 to 9, and with it laravel-debugbar from v3.7.0 to v3.14.10, and I am seeing javascript errors in the debugbar code:

data.statements is undefined

The reason is that an exception happens during debugbar processing:

Debugbar exception: Database connection [graphql] not configured.

While previously the connection's name was simply taken from $query['connection'] in QueryCollector::collect(), it asks Laravel's DatabaseManager for the connection and gets its name from there since commit ed37d1a.

This requires me to configure and register the connection within laravel's database management code, which is pretty complex.

I'd like to see that the code is changed, so that the connection name is taken from the connection object that's provided by the query.

cweiske added a commit to mogic-le/laravel-debugbar that referenced this issue Apr 9, 2025
Instead directly use the query's own connection object.

This makes it possible to log queries for custom non-sql connections
into debugbar relatively easily.

Related: ed37d1a
This commit introduced the usage of DB::connection().

Resolves: barryvdh#1778
cweiske added a commit to mogic-le/laravel-debugbar that referenced this issue Apr 9, 2025
Instead directly use the query's own connection object.

This makes it possible to log queries for custom non-sql connections
into debugbar relatively easily.

Related: ed37d1a
This commit introduced the usage of DB::connection().

Resolves: barryvdh#1778
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant