DEV Community

Cover image for 🤦‍♂️Weekly fail (31/2020)
Zuzana Sojcikova for Kontent.ai

Posted on

5 1

🤦‍♂️Weekly fail (31/2020)

So I was testing out a new GraphQL endpoint to our headless CMS on my local. I used the GraphiQL explorer to compose the GraphQL query and send an Authorization header as the endpoint required valid credentials.

GraphiQL with invalid header definition

However, I kept getting a response 401: Unauthorized. The authorization header was never present on the requests. But why when everything seemed to be correct? I was monitoring the requests using the Network tab, logged headers into the console on the server, nothing. For over an hour I could not figure out why my Authorization header is not being sent.

GraphiQL shows the JSON is invalid

Then I noticed it! A little red line near the closing bracket of my JSON headers definition. There was a trailing comma hidden behind the long Bearer token which made the whole JSON invalid and GraphiQL omitted it from the request. No alert box, no warning, just this tiny little red line 🤦‍♂️

Lesson learned: If your headers are missing even though you defined them, check that your JSON is valid. You know what - always check your JSON is valid :D

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more