API query works in preview but not on live public site

Api query shows data on editor but when published to public site no data is shown.

Hey @nroeder :slight_smile: Hmm, does this API query have some sort of dynamic authentication settings? On public links, we actually collect no user info, which means any kind of authentication would be challenging. All authentication is associated with specific Retool user accounts, and since public app users are fully anonymous there is no user to work with that system.

With that being said, I do have some public apps using an OAuth2 connection to Google Calendar, for example, so it really depends on how your resource is set up!

@victoria I have the same problem too.

I understand what you guys are suspecting. The api that I have doesn't use any user information (like getting username or userid from token, auth headers etc.) to run the query.

select
   po.id,
  po.name,
  po."displayName",
  po.description,
  po."recurringPrice",
  po."nonRecurringPrice",
  pi."imageObjectId",
  json_agg(json_build_object('characteristic', characteristic, 'isPresent', "isPresent") order by "isPresent" desc) as characteristics,
   SUM(CASE WHEN psc."isPresent" = 'Yes' THEN 1 ELSE 0 END) AS featureCount
from
  catalog_management_product_offering po
  LEFT JOIN product_specific_characteristics psc ON po.id = psc."productId"
  LEFT JOIN sdwan_product_images pi ON po.name = pi."productName"
  GROUP BY po.id, pi."imageObjectId", po.name
  order by featureCount

This is the entire query. As you can see, there are no variables in it, no user variables fetched from token, auth headers etc.

@victoria same issue

This got resolved for me

1 Like