Hey friends! đ
Today, I want to share a little debugging adventure that started with what seemed like a small issue but turned into an hour-long hunt. Spoiler: it was all caused by a single typo in Meilisearch's documentation. đ
Weâve been using Meilisearch to enhance our productâs search functionality, and recently, we got a new requirement: We needed to trigger some business logic every time Meilisearch completed indexing.
After exploring Meilisearchâs features, we stumbled upon something that seemed like the perfect solutionâtask webhooks. This feature allows you to get notified when an indexing task is completed, exactly what we needed!
According to the official docs, all we had to do was set up two environment variables: one for the webhook URL and another for the authorization header.
So, we set it up as per the documentation, started indexing some data, and patiently waited for the webhook to trigger. đ It did! But... our business logic didnât execute as expected. đ
We checked the server logs to ensure the webhook was triggering, and it was. But something wasnât rightâour business logic still wasn't running. When we dug into the logs, we found that our server was returning a 401 status code. Uh-oh! đ
Naturally, we thought we messed something up on our serverâs side, particularly with the webhook authorization header validation. We double-checked our Meilisearch environment setupâeverything looked fine. So, we decided to log the incoming request headers to see if the auth header was even being passed correctly.
To our surprise, it was completely empty. đ
At this point, it became clear that the issue wasnât on our side. After a lot of Googling, reading forums, and countless debugging attempts, we still couldnât crack it.
Finally, I decided to take matters into my own hands and dive into Meilisearchâs codebase. I wanted to see exactly how they were sending the webhook event and attaching the authorization header.
And thatâs when I discovered the culprit: a simple typo in their documentation. đ¤Śââď¸
In the code, they were using the environment variable MEILI_TASK_WEBHOOK_AUTHORIZATION_HEADER
, but the docs listed it as MEILI_TASK_AUTHORIZATION_HEADER
. Theyâd accidentally left out the "WEBHOOK" part!
Once we corrected the typo in our environment variable, everything worked like a charm.
Feeling like a true detective, I didnât stop there. I went ahead and submitted a pull request to fix the typo in their documentation so that future developers wouldnât have to go through the same ordeal. The PR got merged, and for a brief moment, I felt like a superhero đ
Finally, donât forget to share your own typo debugging adventures in the comments! Letâs all laugh (or cry) together.
Top comments (0)