Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

P-James's avatar
Level 12

Weird Inertia behavior, validation errors object empty - Production Only

Possibly a Vapor issue.

I've got a form with a validation rule for one of the fields ['required', 'array', 'min:2']. When I submit an empty form, I get the errors object as expected.

But when I submit the form with the required array as length only 1 (not valid), I don't get any errors back. Not for any of the fields, neither the array min:2 field or any other fields.

screenshots

The weirdest part is that this is only happening in production (Laravel Vapor). It works fine locally and I get all my validation errors passed to inertia as you'd expect.

Can anyone suggest what might be happening here?

0 likes
4 replies
NickCousins's avatar
Level 1

For anyone who lands here having the same problem - OP's issue was a year ago so I'd imagine he got to the bottom of it - but I experienced the same thing.

Short Answer

Add the following line to your environment variables in Vapor (e.g. .env.staging file) and redeploy

SESSION_DRIVER=dynamodb

Long Answer

  1. Validation errors are flashed to the session, and then InertiaJS shares them

  2. On your local machine, Laravel likely uses the 'file' driver, and this is probably the default case on Vapor too

  3. Sessions used to be stored in a file when you had only one server to think of. As soon as you start building distributed applications (which a Vapor-powered application is) you are dealing with load balancing across many servers. The validation errors would be flashed to a session file on the server that the initial POST request went to - but there is no guarantee that the subsequent GET request triggered by Inertia will go to the same server (Lambda host container in this case) and in that case, the data will not be on the server.

  4. Resolve this by creating a central store for your session data - e.g. a Database, Cache, etc...

  5. In my case, my application didn't need a database so I just used the DynamoDB driver

6 likes
P-James's avatar
Level 12

@NickCousins I can't remember if I ever resolved it but appreciate you taking the time to post your solution!

Please or to participate in this conversation.