Solving the Astro content collection "No entry type found" error

I had just set up a new content collection and created my first .mdx file. There weren’t any errors, so I thought I was all set, but when I queried the collection it was empty.

Looking through the Astro dev server logs, I saw this warning:

[WARN] [glob-loader] No entry type found for my-new-file.mdx

It took me a minute to realize that I had forgotten to set up the mdx integration! Astro supports markdown out-of-the-box, but not mdx. That’s a separate integration.

I ran the mdx setup command:

npx astro add mdx

Then, I was able to query the collection without issue.