No host Provider Shopify Remix app

No host Provider Shopify Remix app

Iamumar12
Shopify Partner
5 0 0

I'm working on Shopify Remix, but the API POST call is not working on the extension side.

Response
No host provided

Replies 2 (2)

Promer-Aila
Shopify Partner
191 13 60

Hi @Iamumar12 

 

It looks like your Shopify Remix app is encountering an issue where the API POST call fails due to a missing host. This typically happens when the app doesn't correctly retrieve the shop or host parameter required for authentication.

 

Here are some steps to troubleshoot and fix this:

  1. Ensure host is passed correctly – In Remix, the host parameter should be included in requests, either from shopify.session.getCurrentId() or extracted from the URL.
  2. Check Environment Variables – Make sure your .env file includes SHOPIFY_APP_URL and it's correctly set.
  3. Use request.headers for Host – Shopify often sends the host in request headers. Try logging request.headers.get("host") in your API route to verify it’s received.
  4. Ensure OAuth is Handling Host – If you’re using @shopify/shopify-app-remix, ensure handleOAuth is correctly setting the session.
  5. Test with a Hardcoded Host – As a temporary fix, manually set the host in your API call to see if the issue is with the request setup.

If the issue persists, try debugging with console logs to check if host is undefined at any point.

Iamumar12
Shopify Partner
5 0 0

My API URL is correct, but it's giving a 400 error. If the API URL is not correct, it should throw a 404 error. Sometimes I get a 500 error, and sometimes I get a 400 error. Please guide me a little more.
And on the admin side, when I make the call, it works perfectly fine, but on the frontend (extension side), the API is not working