Integration with planetScale acting weird

I am creating a NextJS project using prisma and planetScale database. Everything works on localhost, but not on netlify. The database connection works, I can log in and log out. In the admin menu you can create new posts and list them. The problem is the following:

  • Listing is like caching and even if I delete items from the database, they are still listed on the page. If I log out and back in it will be fine, but on localhost it immediately disappears from there too.
  • The other (and bigger) problem is that in production the create function runs to 404, even though localhost works flawlessly.
    I do not understand the reason for the 404, because all other routes work perfectly.

For now, I am using the same database on local and in production that I created on planetScale.

Here is the code of the create function:

'use client'

    async function onSubmit(event:) {

        const formData = new FormData(;
        const form = Object.fromEntries(formData);
        const response = await createHowItsMade(form)
        if (!response) {
            toast.error("Could not save!")
        toast.success("Saved successfully")
'use server'

export async function createHowItsMade (data): Promise<boolean> {
    try {
      await prisma.howItsMade.create({
        data: {
          title: data.title,
          position: parseInt(data.position),
          description: data.description,
      return true
    } catch (error) {
      return false

Any help would be much appreciated since I have no clue where to start.

Not sure if this is related, but revalidatePath() doesn’t work on Netlify at the moment.

With that being said, without seeing a site, can’t say anything much.

Thanks for the feedback.

I successfully solved the issue by using the API routes with POST and GET methods instead of the ‘use server’ component.

1 Like

Thanks for sharing the solution!