Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Feb 14, 2024 10:07 PM - edited Feb 14, 2024 11:30 PM
I have the following code:
"use server";
import { revalidatePath } from "next/cache";
import { z } from "zod";
import Airtable from 'airtable';
Airtable
.configure({
apiKey: 'PAT KEY'
})
Airtable
.base('ID');
export async function registerSignUp(prevState: { message: string; }, formData: FormData,) {
const schema = z.object({
email: z.string(),
});
const parse = schema.safeParse({
email: formData.get("email"),
});
if (!parse.success) {
return { message: "Failed to sign up" };
}
const data = parse.data;
try {
await Airtable.Table.create(data);
revalidatePath("/");
return { message: `Signed Up!` };
} catch (e) {
return { message: "Failed to sign up" };
}
}
So all of the above, obvs with the PAT key and ID added works locally but not on production.
I am using Vercel free tier to host my site and wonder if that is the problem. Or on airtable there is some CORS or domain whitelisting somewhere
update:
I have added a console log to the catch section for the error thrown and got this:
TypeError: Expected signal to be an instanceof AbortSignal
at new q (/var/task/dist/apps/fe/brochure/.next/server/chunks/838.js:5:131465)
at /var/task/dist/apps/fe/brochure/.next/server/chunks/838.js:5:132911
at new Promise (<anonymous>)
at Object.X [as default] (/var/task/dist/apps/fe/brochure/.next/server/chunks/838.js:5:132863)
at Object.e [as default] (/var/task/dist/apps/fe/brochure/.next/server/chunks/838.js:1:21616)
at e.runAction (/var/task/dist/apps/fe/brochure/.next/server/chunks/838.js:1:10849)
at e._createRecords (/var/task/dist/apps/fe/brochure/.next/server/chunks/838.js:1:24092)
at /var/task/dist/apps/fe/brochure/.next/server/chunks/838.js:1:13135
at new Promise (<anonymous>)
at e.create (/var/task/dist/apps/fe/brochure/.next/server/chunks/838.js:1:13072)
Feb 20, 2024 01:49 AM - edited Feb 20, 2024 08:33 PM
Hello,
Check the versions of the packages that you are using, such as airtable, next, and zod. Make sure that they are the same in your local and production environments, and that they are compatible with each other. You can use the package.json file to specify the exact versions of the packages that you want to use, and run npm install to install them. DogLikesBest
Best Regards
Feb 21, 2024 05:50 AM
Did you manage to solve it? Im getting the same exact error
Mar 25, 2024 08:59 AM
https://github.com/vercel/next.js/issues/55682
Hi, this solved my issue. Set experimental.serverMinification to false in next.config.js. Cheers!