Access Denied Error 1009 on trying to fetch a url in Workers handleRequest function

Hello all-
I’m new to Workers.

I’m trying to create a function that handles requests by fetching data from a 3rd party resource (Shopify store public API) and returning this data as the request-response.

But instead of getting a JSON response from the API, I’m getting an HTML page: Access Denied - You do not have permission to access this website.

No error code is displayed on the page, but I could find a class status-error status-code-1009 in the source code of this HTML page.

I tried a different Shopify store URL and got the same error. It seems the error is persistent across all endpoints on these domains. But I am able to open the same endpoints in a browser or even via Postman.

What am I missing?

What’s the HTML error page?

If it’s a Cloudflare 1009 then that means the website you’re visiting has created a country/region block.

Here’s the page HTML:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="referrer" content="never" />
    <title>Access denied</title>
    <style type="text/css">
        *{box-sizing:border-box;margin:0;padding:0}html{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;background:#F1F1F1;font-size:62.5%;color:#303030;min-height:100%}body{padding:0;margin:0;line-height:2.7rem}a{color:#303030;border-bottom:1px solid #303030;text-decoration:none;padding-bottom:1rem;transition:border-color 0.2s ease-in}a:hover{border-bottom-color:#A9A9A9}h1{font-size:1.8rem;font-weight:400;margin:0 0 1.4rem 0}p{font-size:1.5rem;margin:0}.page{padding:4rem 3.5rem;margin:0;display:flex;min-height:100vh;flex-direction:column}.text-container--main{flex:1;display:flex;align-items:start;margin-bottom:1.6rem}.action{border:1px solid #A9A9A9;padding:1.2rem 2.5rem;border-radius:6px;text-decoration:none;margin-top:1.6rem;display:inline-block;font-size:1.5rem;transition:border-color 0.2s ease-in}.action:hover{border-color:#000}@media all and (min-width:500px){.text-container--main{align-items:center}.page{padding:7.5rem 10.5rem}}
    </style>
</head>

<body class="status-error status-code-1009">
<div class="page">
    <div class="text-container text-container--main">
        <div>
            <h1 data-i18n="content-title">You do not have permission to access this website</h1>
        </div>
    </div>
</div>
</body>

</html>

<script>
  var t = {
  "cs": {
    "title": "Přístup byl odepřen",
    "content-title": "Nemáte oprávnění k přístupu k tomuto webu"
  },
  "nb": {
    "title": "Tilgang nektet",
    "content-title": "Du har ikke tillatelse til å åpne dette nettstedet"
  },
  "th": {
    "title": "การเข้าถึงถูกปฏิเสธ",
    "content-title": "คุณไม่มีสิทธิ์อนุญาตในการเข้าถึงเว็บไซต์นี้"
  },
  "pt-BR": {
    "title": "Acesso negado",
    "content-title": "Você não tem permissão para acessar este site"
  },
  "es": {
    "title": "Acceso denegado",
    "content-title": "No tienes permiso para acceder a esta página web"
  },
  "ko": {
    "title": "액세스가 거부됨",
    "content-title": "이 웹사이트에 액세스할 수 있는 권한이 없습니다"
  },
  "da": {
    "title": "Adgang nægtet",
    "content-title": "Du har ikke tilladelse til at åbne dette website"
  },
  "fi": {
    "title": "Pääsy evätty",
    "content-title": "Sinulla ei ole oikeuksia tämän verkkosivun käyttöön."
  },
  "pt-PT": {
    "title": "Acesso negado",
    "content-title": "Não tem permissão para aceder a este website"
  },
  "de": {
    "title": "Zugriff verweigert",
    "content-title": "Du verfügst nicht über die entsprechende Berechtigung für den Zugriff auf diese Website"
  },
  "it": {
    "title": "Accesso negato",
    "content-title": "Non hai l’autorizzazione per accedere a questo sito web"
  },
  "pl": {
    "title": "Odmowa dostępu",
    "content-title": "Nie masz uprawnień dostępu do tej strony internetowej"
  },
  "sv": {
    "title": "Åtkomst nekad",
    "content-title": "Du har inte behörighet att få tillgång till webbplatsen"
  },
  "en": {
    "title": "Access denied",
    "content-title": "You do not have permission to access this website"
  },
  "hi": {
    "title": "पहुंच अस्वीकृत",
    "content-title": "आपको इस वेबसाइट तक पहुंच प्राप्त करने की अनुमति नहीं है"
  },
  "ja": {
    "title": "アクセスが拒否されました",
    "content-title": "このウェブサイトにアクセスする権限がありません"
  },
  "fr": {
    "title": "Accès refusé",
    "content-title": "Vous n'avez pas l'autorisation d'accéder à ce site web"
  },
  "zh-TW": {
    "title": "存取遭拒",
    "content-title": "您沒有存取此網站的權限"
  },
  "ms": {
    "title": "Akses dinafikan",
    "content-title": "Anda tidak mempunyai kebenaran untuk mengakses laman web ini"
  },
  "tr": {
    "title": "Erişim reddedildi",
    "content-title": "Bu web sitesine erişim izniniz yok."
  },
  "zh-CN": {
    "title": "访问被拒绝",
    "content-title": "您无权访问此网站"
  },
  "nl": {
    "title": "Toegang geweigerd",
    "content-title": "Je hebt geen toestemming voor toegang tot deze website"
  }
};
  var language = navigator.languages && navigator.languages[0] || // Chrome / Firefox
    navigator.language ||   // All browsers
    navigator.userLanguage || // IE <= 10
    "en";
  language = language.split("-")[0]; // Strip country code
  translations = t[language] || t["en"];
  // Replace content on screen
  for (var id in translations) {
    target = document.querySelector("[data-i18n=" + id + "]");
    if (target != undefined) {
      target.innerHTML = translations[id];
    }
  }
  // Replace title tage
  document.title = translations["title"];
  // Replace language tag
  if (t[language]) { document.getElementsByTagName('html')[0].setAttribute('lang', language); };
</script>

Unless Shopify has blocked Cloudflare’s IPs - doesn’t look like a country block. These are ecommerce websites that allow users from everywhere. We are able to access them through Postman and browser.

That’s not a Cloudflare error page so it won’t be Cloudflare’s 1009

I’d recommend reaching out to Shopify - there’s a few mentions of that error page on their community forums but no resolution.