-1

I have running a webserver called Postgrest which generates a REST API on top of a postgres DB. I have this running in Google Cloud run, and have it working for the most part. The HTTP actions I need to take are POST, GET, DELETE and PATCH.

Everything works correctly except PATCH, which I use to update an existing value in the DB. When I run the command from curl command prompt, no error is given, but it doesnt'w work.

https://postgrest-q5mmtshbma-uc.a.run.app/notes?noteid=eq.3 -X PATCH -H "Authorization: Bearer $TOKEN" -H "Conte nt-Type: application/json" -d '{"note" : "updated it!"}'

When I run this against same postgrest version running locally, everything works correctly, so it has me thinking there might be an issue with Google Cloud run and not allowing/accepting PATCH requests? Again, POST, DELETE, GET all work fine.

Anyone have any insight what might be happening here?

mike hennessy
  • 1,359
  • 1
  • 16
  • 35
  • Can you elaborate on "it doesn't work". Does it just return silently? Any errors or other diagnostics? Any traces than can be seen/switched on that show the HTTP traffic? – Kolban Oct 21 '19 at 20:19
  • I don't have any logs..it shows a warning in the "logs" from Google Cloud run, but there is no data/error shown. – mike hennessy Oct 21 '19 at 21:27
  • it ended up being an issue with webserver config. – mike hennessy Oct 22 '19 at 00:11
  • Great news that it is resolved. Can you either delete it or answer it in a way that will be useful to those who come next? – Kolban Oct 22 '19 at 00:54
  • I agree with Kolban. Could you please share the solution for this issue in order to help other community members that may face the same issue ? – Andrei Tigau Oct 22 '19 at 08:39
  • This is likely an error in user land. Cloud Run doesn’t care whether a request is PATCH or POST/GET. – ahmet alp balkan Oct 22 '19 at 15:26

1 Answers1

2

I ultimately found the issue with this was related to using RLS (Row level security) in the PostGres DB, and I had setup specific policy's for insert, update, delete, and select.

The "update" policy I believe was incorrectly setup, so the update failed, but both postgre DB and the postgrest WebServer did not provide an errors to this effect.

Ultimately, when I re-created the update policy on this table, the PATCH (update) command ran successfully.

mike hennessy
  • 1,359
  • 1
  • 16
  • 35