Prefetch requests for Next.js SSG returning 412 status

Using Next.js SSG and prefetching, I am seeing that all of my prefetch requests fail with a 412. Using the XDN devtools, I can see the request and the route it was matched with:

My router is configured with edge caching as follows:

import { Router } from '@xdn/core/router';
import { nextRoutes } from '@xdn/next';
// import getPrerenderRequests from './xdn/getPrerenderRequests';

const SSR_CACHE_CONFIG = {
  browser: {
    maxAgeSeconds: 0,
  },
  edge: {
    maxAgeSeconds: 60 * 60 * 24,
    staleWhileRevalidateSeconds: 60 * 60 * 24,
  },
};

const API_CACHE_CONFIG = {
  browser: {
    maxAgeSeconds: 0,
    serviceWorkerSeconds: 60 * 60 * 24,
  },
  edge: {
    maxAgeSeconds: 60 * 60 * 24,
    staleWhileRevalidateSeconds: 60 * 60 * 24,
  },
};

export default new Router()
  // .prerender(getPrerenderRequests)
  .get('/category/:name', ({ cache }) => cache(SSR_CACHE_CONFIG))
  .get('/product/:id', ({ cache }) => cache(SSR_CACHE_CONFIG))
  .get('/_next/data/:build/category/:name.json', ({ cache }) =>
    cache(API_CACHE_CONFIG)
  )
  .get('/_next/data/:build/product/:id.json', ({ cache }) =>
    cache(API_CACHE_CONFIG)
  )
  .match('/service-worker.js', ({ serviceWorker }) => {
    return serviceWorker('.next/static/service-worker.js');
  })
  .use(nextRoutes); // automatically adds routes for all files under /pages

I did try to make the same request while removing the xdn_prefetch=1 param and see that I get a valid response. Is this something misconfigured in my router that would always reject these requests?

We are improving our support for SSG over the next few weeks. An update that’s coming soon will ensure that SSG pages get into the edge cache at deploy time.

This was not an issue with SSG (I was actually using SSR), but was failing to prerender my URLs so they were prefetch misses.