TypeError: Invalid schema configuration: Z
is not a valid type at path - Zod Schema related
#14491
Closed
1 task done
Labels
can't reproduce
Mongoose devs have been unable to reproduce this issue. Close after 14 days of inactivity.
Stale
Prerequisites
Mongoose version
8.2.3
Node.js version
v20.11.1
MongoDB version
6.0.14
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
11
Issue
I use Sentry and I get this TypeError:
Invalid schema configuration:
Z
is not a valid type at pathdob
. See https://bit.ly/mongoose-schematypes for a list of valid schema types.Dob = date of birth, a string comes from the front end, from a datepicker so I coerce using Zod.
Code:
This ultimately forms part of a
modifyProfileSchema
etc
I then:
export type ModifyProfile = z.infer<typeof modifyProfileSchema>;
and
export type Profile = ModifyProfile & { user_id: string; };
Before finally:
So it is sort of a non-issue, the data saves to the database - when I run it on local and interact with the front-end, it saves, pulls from the database but I constantly get this error from Sentry.
From the 'Z' in the error message I assume something relating to Zod is being passed back but no errors get thrown when I monitor it and ultimately the process works.
Let me know if anyone has any tips or insights.
Thank you.
The text was updated successfully, but these errors were encountered: