Data API throws errors for any table containing an Enum field
Hello, I'm trying to use the Data API with my Postgres database, I have a schema created by the following migration using Prisma:
When I try to query this or any other table (Even ones that don't have the enum) in my database using the Data API, I get the following error:
-- CreateEnum
CREATE TYPE "public"."LeadOrigin" AS ENUM ('value1', 'value2', 'value3', 'value4');
-- CreateTable
CREATE TABLE "public"."marketing_leads" (
"sid" TEXT NOT NULL DEFAULT generate_lead_sid(),
"first_name" TEXT NOT NULL,
"last_name" TEXT NOT NULL,
"lead_origin" "public"."LeadOrigin",
"guests" JSONB NOT NULL DEFAULT '[]',
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
CONSTRAINT "leads_pkey" PRIMARY KEY ("sid")
);-- CreateEnum
CREATE TYPE "public"."LeadOrigin" AS ENUM ('value1', 'value2', 'value3', 'value4');
-- CreateTable
CREATE TABLE "public"."marketing_leads" (
"sid" TEXT NOT NULL DEFAULT generate_lead_sid(),
"first_name" TEXT NOT NULL,
"last_name" TEXT NOT NULL,
"lead_origin" "public"."LeadOrigin",
"guests" JSONB NOT NULL DEFAULT '[]',
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
CONSTRAINT "leads_pkey" PRIMARY KEY ("sid")
);When I try to query this or any other table (Even ones that don't have the enum) in my database using the Data API, I get the following error:
curl -i "https://<my-compute-instance>.apirest.c-2.us-east-2.aws.neon.tech/marketing/rest/v1/marketing_leads?select=sid,first_name,last_name&limit=5" -H "Authorization: Bearer $MY_JWT"
HTTP/2 400
access-control-expose-headers: Content-Encoding, Content-Location, Content-Range, Content-Type, Date, Location, Server, Transfer-Encoding, Range-Unit
content-type: application/json
neon-request-id: aa9ec3a6-b68d-40a1-9aed-ef82491601d5
date: Fri, 24 Oct 2025 19:57:24 GMT
content-length: 142
{"message":"Failed to deserialize json: invalid type: string \"public.\\\"LeadOrigin\\\"\", expected a borrowed string at line 1 column 2043"} curl -i "https://<my-compute-instance>.apirest.c-2.us-east-2.aws.neon.tech/marketing/rest/v1/marketing_leads?select=sid,first_name,last_name&limit=5" -H "Authorization: Bearer $MY_JWT"
HTTP/2 400
access-control-expose-headers: Content-Encoding, Content-Location, Content-Range, Content-Type, Date, Location, Server, Transfer-Encoding, Range-Unit
content-type: application/json
neon-request-id: aa9ec3a6-b68d-40a1-9aed-ef82491601d5
date: Fri, 24 Oct 2025 19:57:24 GMT
content-length: 142
{"message":"Failed to deserialize json: invalid type: string \"public.\\\"LeadOrigin\\\"\", expected a borrowed string at line 1 column 2043"}