Introducing Laravel Error Share
Earlier this month, Laravel changed the default error page from Ignition to their home-baked basic version.
Today, we are releasing a new package called spatie/laravel-error-share, which brings one of Ignition's core features to the new error page: the ability to share errors.
In this blog post, we'd like to tell you all about it.
Why you would share an error
Imagine that you're working on a project locally and bump into an exception. You try to figure out the problem, but you're unable to find a solution. In that case, you might want to ask a colleague for help.
Instead of immediately starting screen sharing with your colleague (or letting your colleague roll their chair to your desk if you work in an office), it might be handy to just send a link to your colleague so that he or she can see that exception in detail.
Using Laravel Error Share
After you install the Laravel Error Share Page, a new "Share" button will be displayed on the default Laravel error page. It looks like this.
When you press that button, a dropdown menu will open, allowing you to choose which information to share.
Of course, like the old Ignition page, we support dark mode as well.
When you press the create share button, all information about your exception will be sent to Flare, and a publicly accessible but hard-to-guess URL will be generated. On that URL, all information about your exception will be displayed.
When you scroll down you see even more information.
You can send that URL to the person(s) you'd like to help you fix the exception. You could also add these URLs to GitHub issues or share them in Slack; they have no expiration date.
Is this secure?
When using Flare's sharing feature, you can choose what exception data and context to include in the shared error page. The following three sections are available for sharing and correspond to the following sections:
- Stack: Provides a detailed stack trace that shows the sequence of method calls leading to the error, including file paths and arguments.
- Context: Offers relevant contextual information about the error, such as request payload, headers, and routing details.
- Debug: Displays additional debugging information like dump output, SQL queries with bindings
Generally, the data included in the Laravel error page and its shared errors is safe to share with colleagues.
However, as always, common sense applies. It is important to note that the data may contain sensitive information, such as database credentials, API keys, or other secrets. Therefore, it is recommended to review the data visible in the error page before sharing it with others. Be especially careful when dealing with production data locally.
How to remove your exception
To maintain privacy and control over shared error pages, Flare offers a simple method for removing shares. When sharing an error, an ownership cookie is automatically set in your browser. To delete the shared error, simply visit the shared error from the same browser and look for the "Delete Share" button.
In the rare event that the "Delete Share" button is not visible or you encounter any issues, you can contact Flare 's dedicated support team at [email protected] and include the share URL you would like to have removed.
In closing
Sharing an error is very handy when you need some help from others to fix a local problem. Using our spatie/laravel-error-share it is easy to make your exception available to others.
This service is provided for free by Flare, the best exception tracker for Laravel apps. Flare is built by all of us at Spatie, you might already know us by our extensive collection of open source packages.