Description
- Laravel Version: 7.x
- PHP Version: 7.4.x
- Database Driver & Version: MySQL 8.x
Description:
#31675 was merged into the Laravel 7 branch to make sure the notifiables for a notification are always a collection. This has lead to several issues for us (using Vapor & SQS) where notifications are now too large for SQS to handle (Message must be shorter than 262144 bytes).
In Laravel 6.x and below, if sending a notification to a single user, the user model was serialized, which to me is the expected behavior. In 7.x, the user model is wrapped in a collection, and thus not serialized. If an application has any fields in their User model with large amounts of text, it will quickly cause the notification content to be too large to queue using SQS. The same notification being queued in Laravel 7 grew to 9627 characters from 2276 characters in Laravel 6, just due to the notifiable no longer being serialized.
As of now, I'm not certain there is a workaround for this issue, other than somehow overriding the SendQueuedNotifications class to revert this change.
Steps To Reproduce:
- Install Laravel 7.x
- Create User to receive notification
- Create notification with any data passed in as parameters, and make sure it uses the queue
- Call $user->notify() using your created notification
- Verify the queued content to see the User object is not serialized