Closed ammarriq closed 1 month ago
Thanks for reporting and thanks for the reproduction steps. I will have a look at it later.
I have submitted a bug report: https://github.com/vercel/edge-runtime/issues/899
There are other problems with the current plain object check, for example in #587, but I am not sure if Valibot is the problem. Normally, this should not be a problem. We could remove the input.constructor === Object
check to make it less strict, but then any object that is not null
will be accepted. In practice, this is usually not a problem because we never return the original object. So, strictly speaking, the validation is still safe. Therefore, I might make the validation less strict so as not to have to deal with special JS runtime behavior that we can't control.
One problematic case that just came to my mind that could lead to unexpected behavior is our looseObject
and objectWithRest
schemas, as they can add unexpected data to the output if the wrong object types are passed.
This is fixed in v0.31.0-rc.6
Valibot object schema doesn't seem to work with
edge
runtimeSteps to reproduce;
paste the code in page.tsx
export const runtime='edge'
it will throw an error;
Error: Invalid type: Expected Object but received Object
it should also throw an error for other frameworks optiong into
edge
runtime