Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Valibot schema.safeParseAsync is not a function #242

Open
2 tasks done
pedro757 opened this issue Aug 22, 2024 · 2 comments
Open
2 tasks done

[BUG] Valibot schema.safeParseAsync is not a function #242

pedro757 opened this issue Aug 22, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@pedro757
Copy link

Are you using the latest version of this library?

  • I verified that the issue exists in the latest next-safe-action release

Is there an existing issue for this?

  • I have searched the existing issues and found nothing that matches

Describe the bug

I get this validation error

schema.safeParseAsync is not a function

for this

action
  .schema(
    object({
      id: number(),
      status: enum_(StatusEnum),
    }),
  )
  .action(async function ({ parsedInput }) {
...

With this input

{
    "id": 4,
    "status": "Draft"
}

Reproduction steps

  1. use latest version of [email protected]
  2. use latest version of [email protected]

Expected behavior

Not to error with latest valibot version

Minimal reproduction example

The code is in the description of the issue

Operating System

Linux

Library version

7.7.1

Next.js version

14.2.6

Additional context

No response

@pedro757 pedro757 added the bug Something isn't working label Aug 22, 2024
@TheEdoRan
Copy link
Owner

The code is in the description of the issue

Unfortunately this is not a link to a project with a minimal reproduction of the issue. In order to help you, I need to see the code where you create the safe action client, so I can understand what's really happening here, half of the action definition isn't enough to debug this problem. Please provide it as a comment, thanks!

@TheEdoRan
Copy link
Owner

TheEdoRan commented Sep 3, 2024

A quick question: have you set up the safe action client with the correct validation adapter for Valibot as explained in this page of the website?

This might be the only issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants