PostgreSQL data source Returning "Invalid Response Format"

  • 2
  • Question
  • Updated 3 weeks ago
  • Answered
Skuid Version:12.0.4

I can't get a PostgreSQL data source to return any data. I've tried messing around with the javascript a bunch but any call I make to postgres from an actual running page returns  
Invalid Response Format
I know my connection is working because from the configure tab I was able to retrieve tables and fields dynamically from the database using the "Import Data Source Object" mechanism and from the page builder I'm able to create models from that data source. What's going on here? How can I debug this further?


Photo of Shmuel Kamensky

Shmuel Kamensky, Champion

  • 4,698 Points 4k badge 2x thumb

Posted 3 months ago

  • 2
Photo of Zach McElrath

Zach McElrath, Employee

  • 51,648 Points 50k badge 2x thumb
Shmuel, sorry to hear you're having trouble getting data to be returned. Does the SQL user that you're connecting with have Read access on the tables that you're connecting with? 

First step, I'd do the following --- go to the "Network" tab in Chrome and refresh your Skuid Page. Look for an XHR request whose network endpoint ends with "load", and then go into "Preview" the response, there is probably a "message" property in the response that will give additional information.

What fields / conditions did you configure in the Model?
Photo of Shmuel Kamensky

Shmuel Kamensky, Champion

  • 4,698 Points 4k badge 2x thumb
Do'h! The SQL user did not have access to anything! I made a special role for skuid and didn't give it access to anything. Granting it access to the proper database, schema, tables, and sequences fixed it. Somehow it had access to the table metdata (maybe some kind of default permission Heroku gave).

Thanks!

------------------------------------------------------
Notes from before I solved that:
I looked at the load XHR request before before I posted and didn't notice anything strange. I just did it again. There are two load requests, one with a POST verb and one with an OPTION verb. The POST verb returns a json object with the table metadata (and it contains the correct metadata), the OPTIONS doesn't have a previewable response.

I have no conditions and configured all fields from the table to be present in the model.


(Edited)
Photo of Huyen York

Huyen York, Employee

  • 224 Points 100 badge 2x thumb
Shmuel, 

Some possible causes:
  1. When there's a field you include in the Model that doesn't exist in the Datasource Object. So maybe you delete a field in the DB but still have it on your Skuid page?
  2. You have child relationship or subquery conditions
General PostgreSQL datasource debugging tips

If you have multiple Postgres models on the page, you should go to the Advanced tab, and uncheck "Request data in the same transfer as other Models", this way you can request each of the models separately, which helps with debugging and finding the "bad" model. 

Once you do that, open your Dev Console then reload the page with the Network tab open
Look for a request like this, and you can click it and look at the Preview tab. If you see models: null, then that's probably your bad model. You should get more details there, something like lastQueryString which gives you the SQL statement that Skuid made against your db to query data, for example. 


Example response in the Preview tab looks like this. If yours says models: null, then it's likely to get "Invalid Response Format" error on the Skuid page




Photo of SAMJOSEPH

SAMJOSEPH

  • 80 Points 75 badge 2x thumb
hey, i was also looking for the same. thank you for the responses.. it was helpful.
best regards!!!