I cannot figure out how to externally access the API that I created.

Topic summary

A developer is unable to successfully make external API requests to their Shopify app endpoint and has been troubleshooting for 2 days without success.

The Problem:

  • cURL POST requests to /api/hi endpoint return no response or error messages
  • No console output appears in the running server
  • Tested both the Shopify store domain (STORE_DOMAIN.myshopify.com/admin/apps/APP_ID/api/hi) and auto-generated Cloudflare domain

Current Setup:

  • Using shopify.validateAuthenticatedSession() middleware on /api/* routes
  • Simple endpoint that should log ‘hihi’ and return {hi: 'buddy'}
  • Including X-Shopify-Access-Token header in requests

Server Logs Show:

  • “Running validateAuthenticatedSession”
  • “Session was not valid” with undefined shop parameter
  • “Redirecting to /api/auth?shop=undefined”
  • “Missing Authorization header” error from shopify-api
  • Response: “Found. Redirecting to /api/auth?shop=undefined”

Status: The issue appears related to authentication/session validation failing, causing redirects instead of reaching the endpoint. The discussion remains open with no solution provided yet.

Summarized with AI on November 20. AI used: claude-sonnet-4-5-20250929.

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.