Cannot make integration API calls

Hi guys… I cannot make api calls via integration to the backend server running on localhost… I always get network error or some internal error.

Please help me with this… So, I have a Next plasmic Project … working as both frontend & backend… But I cant make integration api calls from plasmic studio to my backend server

Hey @illuminating_egret! Unfortunately, this is not possible.

The data queries runs in the plasmic server so we don’t have access to your localhost.

The data queries run on the Plasmic server, so we don’t have access to your localhost.
However, you can use the HTTP REST API Fetcher component, which runs in the browser, to achieve this. You’ll need to host the Plasmic app within your own app. You can find more information on how to host Plasmic Studio in your app in the documentation here:

Let me know if this helps you

Screen Shot 2023-11-21 at 11.25.22.png

Hi @samuel wouldn’t that create exposed API keys on the front end? What is the recommended approach to secure this or work with this component? I realise this is a localhost setup so no risk but if this was pushed live then you could technically find the API keys in the browser dev tools

@empirical_scallop That’s correct. You basically need to decide what you want, whether you want the api calls to go through our back end or not. If they go through our back end, then we need to be able to reach the final API endpoint, and auth is taken care of. If they go through your browser, then either the API endpoint is public, or you are relying on your own cookie/session auth - this should be no different than if you are pretending that plasmic doesn’t exist, what would you do. Let me know if that makes sense.

Thanks Yang… Makes sense, was just wondering if I was missing something obvious.