Skip to content
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

Serialization of 'PDO' is not allowed - Queued Audits #879

Closed
philip1337 opened this issue Dec 14, 2023 · 9 comments
Closed

Serialization of 'PDO' is not allowed - Queued Audits #879

philip1337 opened this issue Dec 14, 2023 · 9 comments
Labels
bug Issue, error or unexpected behavior help wanted Assistance or contributions needed

Comments

@philip1337
Copy link

Q A
Bug? yes
New Feature? yes
Framework Laravel
Framework version 10.10
Package version v13.6.0
PHP version 8.3.0

Actual Behaviour

stacktrace.txt

After upgrading to v13.6.0 with the new queued audits feature, ends up in serialization issues.

Expected Behaviour

Should save the model I guess

Steps to Reproduce

Upgrade to the new laravel-auditing version.

Possible Solutions

Downgrade a version below.

@angeljqv
Copy link
Contributor

#846

@Orrison
Copy link
Contributor

Orrison commented Dec 15, 2023

Just to confirm, based on your stack trace you have audit.queue.connection set to sync right? If so, any more details on the issue you could provide? What does your Model look like that is through this serialization issue?

@philip1337
Copy link
Author

Hello,

it's from an upgrade.
I didn't touch the setting.

So it's the default one:
https://github.com/owen-it/laravel-auditing/blob/v13.6.0/config/audit.php#L168-L172

From the stack trace we can see it's using the SyncQueue:

  {
      "file": "vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php",
      "line": 38,
      "function": "createPayload",
      "class": "Illuminate\\Queue\\Queue",
      "type": "->"
  },

I can confirm that accesing the setting is resulting in 'sync'.
'config("audit.queue.connection")'

Model

My model is a bit more complex than the normal ones.
I think it's related to an attribute from the model that can't be serialized.

I'll try to provide more informations asap regarding the model.

@MortenDHansen
Copy link
Contributor

MortenDHansen commented Dec 15, 2023

Yeah, it looks like it wont serialize. The problem seems to be from the model like you suspect. If you can get us some details on what cant be serialized, we could try and test and find a way to deal with it. I haven't found a case to recreate the issue with.

@Orrison - can you help?

In the meantime, you may of course simply revert back to the previous version in composer.json

@MortenDHansen MortenDHansen added bug Issue, error or unexpected behavior help wanted Assistance or contributions needed labels Dec 15, 2023
@Orrison
Copy link
Contributor

Orrison commented Dec 15, 2023

@MortenDHansen sure thing.

@philip1337 that makes sense. From the look of the stacktrace it seems you have an attribute that is possibly something like a QueryBuilder? More details on the attribute would help track down the issue and what could be done to fix it.

@erikn69
Copy link
Contributor

erikn69 commented Dec 15, 2023

Try disable it with #881

@philip1337
Copy link
Author

Try disable it with #881

It is already disabled but since it's getting dispatched trough the SyncQueue it's still getting serialized.
I started debugging it and I'll post an update asap on how it happens.
I can reproduce it I just didn't find the time to look into it.

@MortenDHansen
Copy link
Contributor

The opt-in version of v13.6.0 has been released. I hope that solves it :)

@philip1337
Copy link
Author

It solved it.

As mentioned before my assumption turned out correct, there was an attribute that one of the other developers
set that couldn't be serialized.

Thanks for the help, I really like this library!

Kind regards
Philip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue, error or unexpected behavior help wanted Assistance or contributions needed
Projects
None yet
Development

No branches or pull requests

5 participants