Laravel Telescope: Data too long for column ‘content’

Oh Dear! monitors your entire site, not just the homepage. We crawl and search for broken pages and mixed content, send alerts when your site is down and notify you on expiring SSL certificates.

Start your free 10 day trial! »

Image of Mattias Geniar

Mattias Geniar, November 04, 2018

Follow me on Twitter as @mattiasgeniar

For Oh Dear!, we’re using Laravel Telescope as a convenient way of tracking/displaying exceptions, runs, …

It stores its exceptions in the database, so you can easily view them again. It stores those in a TEXT field in MySQL, which is limited to 2^16 bytes, or 65536 bytes. Some of our exceptions tend to be pretty long, and they were hitting this limit.

The fix is to transfer the column from a TEXT to a LONGTEXT instead.

MariaDB [ohdear]> ALTER TABLE telescope_entries MODIFY content LONGTEXT;

You now have 2^32 bytes for storing data, or 4MB.

The table will now show it has a LONGTEXT field instead.

MariaDB [ohdear]> describe telescope_entries;
+-------------------------+---------------------+------+-----+---------+----------------+
| Field                   | Type                | Null | Key | Default | Extra          |
+-------------------------+---------------------+------+-----+---------+----------------+
| sequence                | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| uuid                    | char(36)            | NO   | UNI | NULL    |                |
| batch_id                | char(36)            | NO   | MUL | NULL    |                |
| family_hash             | varchar(191)        | YES  | MUL | NULL    |                |
| should_display_on_index | tinyint(1)          | NO   |     | 1       |                |
| type                    | varchar(20)         | NO   | MUL | NULL    |                |
| content                 | longtext            | YES  |     | NULL    |                |
| created_at              | datetime            | YES  |     | NULL    |                |
+-------------------------+---------------------+------+-----+---------+----------------+
8 rows in set (0.00 sec)

Your exceptions/stacktraces should now be logged properly.

Will you help me share this post?

It would mean a lot to me if you could help share this post on social media. 🤗