async function handler({ req, res }) {
  if (req.method !== 'GET') {
    throw new Error('Only GET requests are supported.');
  }