Reputation: 1
I'm encountering an issue with Payload CMS where I'm getting a GraphQL error related to enum value naming. I have a collection called FormSubmission with a field named appointmentTime that uses a select field type with predefined options. Here's the relevant code snippet:
import { CollectionConfig } from "payload/types";
const FormSubmission: CollectionConfig = {
slug: "form-submissions",
fields: [
{
type: "select",
name: "appointmentTime",
label: "Appointment Time",
required: true,
options: [
{ label: "09:00 AM", value: "09:00" },
{ label: "10:00 AM", value: "10:00" },
{ label: "11:00 AM", value: "11:00" },
{ label: "12:00 PM", value: "12:00" },
{ label: "01:00 PM", value: "13:00" },
{ label: "02:00 PM", value: "14:00" },
{ label: "03:00 PM", value: "15:00" },
{ label: "04:00 PM", value: "16:00" },
{ label: "05:00 PM", value: "17:00" },
],
},
],
};
export default FormSubmission;
When I run the application using yarn run dev, I get the following error:
unhandledRejection GraphQLError: Names must only contain [_a-zA-Z0-9] but "_9:00" does not.
The code was working previously, and I haven't made any changes to it. I'm using the latest versions of Payload CMS and its dependencies. I'm not sure what could be causing this issue, as the enum values in the code appear to be valid. I would appreciate any insights or suggestions on how to resolve this error.
I have tried deleting the file and starting again, restarting dev server, isolating the code with /*
Upvotes: 0
Views: 314