Skip to content

[symfony/messenger 5.4.8] Attempted to call an undefined method named "pgsqlGetNotify" of class "Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingServerInfoAwareDriverConnection #46436

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
FractalizeR opened this issue May 22, 2022 · 3 comments

Comments

@FractalizeR
Copy link
Contributor

Symfony version(s) affected

5.4

Description

Expected Result

It works, consuming messages...

Actual Result

In PostgreSqlConnection.php line 82:

Attempted to call an undefined method named "pgsqlGetNotify" of class "Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingServerInfoAwareDriverConnection".  

Original report is here: getsentry/sentry-symfony#626

How to reproduce

Run Symfony Messenger with the bin/console messenger:consume command to consume messages from PostgreSQL.

Possible Solution

Downgrade symfony/doctrine-messenger to version 5.4.7.
The error seems to be related to symfony/doctrine-messenger@7e03e21

Additional Context

doctrine/dbal 2.13.8
sentry/sentry-symfony 4.2.9
symfony/messenger 5.4.8
symfony/doctrine-messenger 5.4.8
@derrabus
Copy link
Member

If you can, please consider upgrading to DBAL 3.3 or later. Fixing this kind of issue on DBAL 2 is a real PITA.

In PostgreSqlConnection, can you please locate this block:

$wrappedConnection = $this->driverConnection->getWrappedConnection();
if (!$wrappedConnection instanceof \PDO && $wrappedConnection instanceof DoctrinePdoConnection) {
    $wrappedConnection = $wrappedConnection->getWrappedConnection();
}

Can you please change it into this:

$wrappedConnection = $this->driverConnection;
while (\method_exists($wrappedConnection, 'getWrappedConnection')) {
    $wrappedConnection = $wrappedConnection->getWrappedConnection();
}

Does this solve your problem?

@Hadrien45
Copy link

Hi @derrabus,

The problem is solved with your change.

Since my original issue in sentry repository, I had also upgrade the dependencies of my project to

doctrine/dbal 2.13.9
sentry/sentry-symfony 4.3.0

and it works.

@xabbuh
Copy link
Member

xabbuh commented Jun 7, 2022

see #46610

@fabpot fabpot closed this as completed Jun 7, 2022
fabpot added a commit that referenced this issue Jun 7, 2022
…bbuh)

This PR was merged into the 5.4 branch.

Discussion
----------

[Messenger] use the outermost wrapping DBAL connection

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #46436
| License       | MIT
| Doc PR        |

Commits
-------

4178244 use the outermost wrapping DBAL connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants