<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Zuzana Sojcikova</title>
    <description>The latest articles on Forem by Zuzana Sojcikova (@suzii).</description>
    <link>https://forem.com/suzii</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F438550%2F0a920d2d-2a42-4273-b12a-c4b1b16813c7.jpeg</url>
      <title>Forem: Zuzana Sojcikova</title>
      <link>https://forem.com/suzii</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/suzii"/>
    <language>en</language>
    <item>
      <title>🤦‍♂️Weekly fail (31/2020)</title>
      <dc:creator>Zuzana Sojcikova</dc:creator>
      <pubDate>Tue, 28 Jul 2020 08:54:12 +0000</pubDate>
      <link>https://forem.com/kontent_ai/weekly-fail-31-2020-4ih5</link>
      <guid>https://forem.com/kontent_ai/weekly-fail-31-2020-4ih5</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb04d7h8ameahy54mrlat.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb04d7h8ameahy54mrlat.png" alt="GraphiQL with invalid header definition"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, I kept getting a response &lt;code&gt;401: Unauthorized&lt;/code&gt;. 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.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fixa8h3arogtd3hubvz6h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fixa8h3arogtd3hubvz6h.png" alt="GraphiQL shows the JSON is invalid"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;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 🤦‍♂️&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Lesson learned:&lt;/em&gt; &lt;strong&gt;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&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>fail</category>
      <category>lessonslearned</category>
      <category>graphiql</category>
      <category>json</category>
    </item>
  </channel>
</rss>
