Cannot call global action from app proxy

Please see files below star_rating.liquid <script defer src="https://santaproxy--development.gadget.app/api/client/web.min.js"></script> <script> document.addEventListener("DOMContentLoaded", () => {
window.bannerTutorialApi = new SantaproxyClient({ browserSession: { shopId: {{ shop.id }} }, // the proxy path defined in your shopify.app.toml file, format: /<prefix>/<subpath> endpoint: "/apps/gadget-banner-tutorial" }); // client looks correct, see image attached console.log(window.bannerTutorialApi) window.bannerTutorialApi.getBanner() // gets error Failed to load resource: the server responded with a status of 500 ()
}); </script> {% schema %} { "name": "Star Rating", "target": "section", "settings": [ { "type": "product", "id": "product", "label": "product", "autofill": true }, { "type": "color", "id": "colour", "label": "Star Colour", "default": "#ff0000" } ] } {% endschema %} shopify.app.development.toml client_id = "0eda3daca298da40014ffa46bc321216" name = "santaproxy" application_url = "https://santaproxy--development.gadget.app/api/shopify/install-or-render" embedded = true [auth] redirect_urls = ["https://santaproxy--development.gadget.app/api/connections/auth/shopify/callback"] [webhooks] api_version = "2025-10" [[webhooks.subscriptions]] compliance_topics = ["customers/data_request", "customers/redact" ,"shop/redact"] uri = "https://santaproxy--development.gadget.app/api/webhooks/shopify" [app_proxy] url = "https://santaproxy--development.gadget.app/api/graphql" subpath = "gadget-banner-tutorial" prefix = "apps" actions/getBanner.js export const run = async ({ params, logger, api, connections }) => {
console.log("connections")
return {body: "This is a test message"}; };
getBanner has unauthenticated access
No description
No description
2 Replies
Chocci_Milk
Chocci_Milk5w ago
Hello, The roll that will be set on the request, no matter if you're using a proxy or not, will be the unauthenticated role as the request is not being passed a signed token from Shopify. No token will ever be passed from the storefront as its only really an authenticated space when the user is logged in. However, this doesn't mean that you can't protect the action. You can use connections.shopify.current determine if the proxy is being used on the action. Btw, I would also recommend that you change your proxy settings to hit the root of the application and then set the client with the correct endpoint in the extension. I would recommend taking a look at this example code: https://github.com/gadget-inc/templates/tree/main/shopify/product-quiz-public-remix-ssr (Specifically the extension code)
GitHub
templates/shopify/product-quiz-public-remix-ssr at main · gadget-i...
A collection of helpful app templates to accelerate your development with Gadget - gadget-inc/templates
Gizmo
Gizmo4d ago
Do you like this answer? ​

Did you find this page helpful?