nova-issues icon indicating copy to clipboard operation
nova-issues copied to clipboard

400 Bad Request / InvalidQueryStringException Error when using Nova and Laravel Vapor

Open amcfarlane opened this issue 2 years ago • 2 comments

  • Laravel Version: 9.48.0
  • Nova Version: 4.22.0

When you try to detach a MorphToMany field when using Laravel Vapor and Nova you get the following error:

Request URL: https://example.lambda-url.us-example-1.on.aws/nova-api/users/detach?search=&filters=W10%3D&trashed=&viaResource=cars&viaResourceId=3&viaRelationship=&resources[]=11 Request Method: DELETE Status Code: 400 Bad Request

Connection: keep-alive Content-Length: 16 Content-Type: application/json Date: Mon, 20 Feb 2023 14:54:20 GMT x-amzn-ErrorType: InvalidQueryStringException x-amzn-RequestId: example-2078-491f-ac60-7d36acfe2922

This is due to the double bracket within "resources[]", a limitation of the API Gateway Lambda Proxy. It may need "percent-encoding" of the query string to work.

https://stackoverflow.com/questions/53371401/invalidquerystringexception-on-aws-iam-secured-api-gateway-lambda-proxy

amcfarlane avatar Feb 20 '23 15:02 amcfarlane

Vapor support got back to me and is a limitation of the function URLs provided by Lambda. I updated to a custom/vanity domain and this fixed the issue. May be worth highlighting somewhere in the docs that default Nova doesn't play well with the free version of Vapor. Or maybe amend Nova so it works out of the box with function URLs provided by Lambda.

amcfarlane avatar Feb 20 '23 20:02 amcfarlane

The URLs are generated via Axios, I'll talk with the team regarding where's the best place to document this limitation.

crynobone avatar Feb 21 '23 04:02 crynobone