Next.js Discord

Discord Forum

Odd errors blocking from build but works good locally

Unanswered
Blanc de Hotot posted this in #help-forum
Open in Discord
Blanc de HototOP
Got pages that aren't rendering with server side requests
Generating static pages (0/10) [ ]TypeError: Expected signal to be an instanceof AbortSignal
Error occurred prerendering page "/q/furniture-details". Read more: https://nextjs.org/docs/messages/prerender-error

Each page:

import FunnelHeading from "@/components/funnel/funnel-heading";
import FurnitureForm from "@/components/funnel/furniture-details-form";
import { getRecords } from "@/lib/airtable";

export default async function FurnitureDetailsPage() {
  const records = (await getRecords("formInputs")).filter((record) =>
    record.section.find((section: string) => section === "furnitureDetails")
  );
  return (
    <div>
      <FunnelHeading
        title="Furniture Details"
        description="Tell us about your furniture"
      />
      <FurnitureForm records={records} />
    </div>
  );
}


My getRecords() function
export const getRecords = async (table: string) => {
  let results: any[] = [];
  await new Promise((resolve, reject) => {
    base(table)
      .select({
        maxRecords: 1000,
        view: "Grid view",
      })
      .eachPage(
        function page(records, fetchNextPage) {
          // This function (`page`) will get called for each page of records.

          records.forEach(function (record) {
            results.push({ id: record.id, ...record.fields }); // Push the record id and the entire record fields object
          });

          // To fetch the next page of records, call `fetchNextPage`.
          // If there are more records, `page` will get called again.
          // If there are no more records, `done` will get called.
          fetchNextPage();
        },
        function done(err) {
          if (err) {
            console.error(err);
            reject(err);
          }
          resolve(results);
        }
      );
  });
  return results;
};

1 Reply

Blanc de HototOP
Bug introduced in Next 13.5!

Downgraded to Next 13.4 and everything works, pages are building in prod.