Build fails due to mime-db – also affects previously successful builds

Hi everyone,

I’m running into a strange issue with my blog project that’s hosted on Vercel.

All of a sudden, my builds are failing with a syntax error coming from the mime-db package. What’s more confusing is that even builds that were previously successful can no longer be rebuilt — they now fail with the same error.

Here’s the error message:

/vercel/path0/node_modules/.pnpm/mime-db@1.25.0/node_modules/mime-db/db.json:5
0 && (module.exports = {application/1d-interleaved-parityfec,applicat...etc

SyntaxError: Unexpected token '/'

I’m using Node 22 and running pnpm install && pnpm run build.

Has anyone experienced something similar? Any ideas on how to resolve this would be greatly appreciated.

Thanks in advance!

Hey @raoun4136 , Is this coming from building the application (ex. next build) or some other build context (sitemap, rss, etc)? You should be able to see that in the deployment logs of what script was being executed.

That error definitely looks odd considering it says its a .json file that has a JS module.exports.

1 Like

Thanks for pointing it out. I looked into it a bit more, and it seems like the error isn’t coming from next build directly — it’s likely happening during my custom RSS generation script that runs before the build.

Here’s how I run it in package.json:

"build": "pnpm run generate-rss && next build",
"generate-rss": "npx tsx src/scripts/generate-rss.ts"

generate-rss.ts

import { generateRSS } from '../components/lib/rss';
import fs from 'fs';
import path from 'path';

async function main() {
  const rss = generateRSS();
  const outputPath = path.join(__dirname, '../../public');

  fs.mkdirSync(outputPath, { recursive: true });
  fs.writeFileSync(path.join(outputPath, 'feed.xml'), rss);
}

And here’s a snippet from generateRSS()

import RSS from 'rss';
import fs from 'fs';
import path from 'path';
import matter from 'gray-matter';
import { CommonMetaData } from './constant';

export const generateRSS = () => {
  const feed = new RSS({
    title: CommonMetaData.title.default,
    description: CommonMetaData.description,
    site_url: CommonMetaData.metadataBase.toString(),
    feed_url: CommonMetaData.metadataBase.toString() + 'feed.xml',
    pubDate: new Date(),
  });

  const pages = fs.readdirSync(path.join('src/mdx/pages'));

  pages.forEach((file) => {
    const content = fs.readFileSync(path.join('src/mdx/pages', file), 'utf-8');
    const { data: frontMatter } = matter(content);
    feed.item({
      title: frontMatter.title,
      description: frontMatter.description,
      url: `${CommonMetaData.metadataBase}pages/${file.replace('.mdx', '')}`,
      date: new Date(frontMatter.date),
    });
  });

  return feed.xml();
};

As you can see, nothing fancy — just file reads, frontmatter parsing, and RSS XML writing.
Locally everything works fine, but the deployed environment throws an error.

I’d appreciate it if you could tell me how to debug it. Should I give you my build link by any chance?

When you say locally, you mean running the generate-rss feed script locally? Can you make sure that src/mdx/pages exists?

1 Like