Hey guys, am I doing something wrong while requesting to hit an API endpoint in my app? My curl request is doing nothing:
curl -X POST [https://STORE_DOMAIN.myshopify.com/admin/apps/APP_ID/api/hi](https://store_domain.myshopify.com/admin/apps/APP_ID/api/hi) -H 'Content-Type: application/json' -H 'X-Shopify-Access-Token: MY_ACCESS_TOKEN'
Nothing is returned from my request, not even an error message. Also no console outputs in my server that’s running in a separate window.My code in web/index.js:
app.use("/api/*", shopify.validateAuthenticatedSession());
app.use(express.json());
app.post("/api/hi", async (req, res) => {
console.log('hihi');
res.send({hi: 'buddy'});
});
I’ve also tried using the cloudflare domain which is autogenerated when you start the server:
curl -X POST [https://AUTOGENERATED_CLOUDFLARE_DOMAIN/admin/apps/APP_ID/api/hi](https://autogenerated_cloudflare_domain/admin/apps/APP_ID/api/hi) -H 'Content-Type: application/json' -H 'X-Shopify-Access-Token: MY_ACCESS_TOKEN'
My response is:
Found. Redirecting to /api/auth?shop=undefined
The logs in my terminal window with the server running:
2023-05-23 09:04:45 │ backend │ [shopify-app/INFO] Running validateAuthenticatedSession
2023-05-23 09:04:45 │ backend │ [shopify-app/INFO] Session was not valid. Redirecting to /api/auth?shop=undefined | {shop: undefined}
2023-05-23 09:04:45 │ backend │ [shopify-api/ERROR] Missing Authorization header, was the request made with authenticatedFetch? | {isOnline: false}
I’ve tried many different things in the past 2 days, and I cannot seem to figure out what I’m missing while trying to make this request.