joi icon indicating copy to clipboard operation
joi copied to clipboard

"Schema can only contain plain objects" when using Joi with SSR

Open MajorMeerkatThe3rd opened this issue 1 year ago • 0 comments

Support plan

  • is this issue currently blocking your project? (yes/no): yes
  • is this issue affecting a production system? (yes/no): yes

Context

  • node version: 16.9.0
  • module version: [email protected]
  • environment (e.g. node, browser, native): browser
  • used with (e.g. hapi application, another framework, standalone, ...): nuxt
  • any other relevant information: only happens with SSR

How can we help?

When using the pattern command, I get the error "Schema can only contain plain objects". This only happens when trying to enable SSR.

import Joi from "joi";

// copy pasted from the example
const schema = Joi.object({ a: Joi.string() }).pattern(/\w\d/, Joi.boolean());

MajorMeerkatThe3rd avatar Apr 19 '23 13:04 MajorMeerkatThe3rd