# Having trouble running sample web app locally

**URL:** https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514
**Category:** 🤝  Community Help
**Created:** [May 31, 2022, 4:08pm UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514 "2022-05-31T16:08:55Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![HelicoptersofDC](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/helicoptersofdc/32/369_2.png) [@HelicoptersofDC](https://discuss.roboflow.com/u/HelicoptersofDC)
#### Post date: [May 31, 2022, 4:08pm UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/1 "2022-05-31T16:08:56Z")

</div>

I have copy and pasted the source code from the sample web app to my local machine to start tweaking it, but I get:  
"Error loading response.

Check your API key, model, version,  
and other parameters  
then try again."  
I have checked all the parameters, but I see an outside script referenced at the bottom of the code:  
`<script src="/infer.e52137ed1b27e0a86d5a.js"></script>`  
I have tried replacing that with what I believe to be the absolute address (if I had permission to run it off server, which may be unlikely):  
`<script src="https://detect.roboflow.com/infer.e52137ed1b27e0a86d5a.js"></script>`  
I get the same result. Any advice appreciated!

Edit: for reference [here](https://detect.roboflow.com/?model=helicopters-of-dc-ghwuq&version=1&api_key=) is the sample web app I pulled down minus my api key.

---

<div class="post-metadata">

### Author: ![HelicoptersofDC](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/helicoptersofdc/32/369_2.png) [@HelicoptersofDC](https://discuss.roboflow.com/u/HelicoptersofDC)
#### Post date: [June 1, 2022, 2:47am UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/2 "2022-06-01T02:47:21Z")

</div>

figured it out!  
would have to enable access to external https requests on localhost, ran just fine on my FTP/web provider:

> <https://stackoverflow.com/questions/20035101/why-does-my-javascript-code-receive-a-no-access-control-allow-origin-header-i>

---

<div class="post-metadata">

### Author: ![brad](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/brad/32/23_2.png) [@brad](https://discuss.roboflow.com/u/brad)
#### Post date: [June 1, 2022, 12:13pm UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/3 "2022-06-01T12:13:20Z")

</div>

Just double checking that by “pulled down” you mean using the code from the codepen linked on the bottom right vs saving the source code from that page which includes some extra boilerplate from our serverside build and analytics: [https://codepen.io/roboflow/pen/VwaKXdM](https://codepen.io/roboflow/pen/VwaKXdM)

---

<div class="post-metadata">

### Author: ![HelicoptersofDC](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/helicoptersofdc/32/369_2.png) [@HelicoptersofDC](https://discuss.roboflow.com/u/HelicoptersofDC)
#### Post date: [June 1, 2022, 12:43pm UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/4 "2022-06-01T12:43:24Z")

</div>

I did it that way the first time then ran into this external request issue and just pulled the source code off the page, but I will go grab that code again now.  
Thanks!

---

<div class="post-metadata">

### Author: ![brad](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/brad/32/23_2.png) [@brad](https://discuss.roboflow.com/u/brad)
#### Post date: [June 1, 2022, 12:58pm UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/5 "2022-06-01T12:58:18Z")

</div>

Good feedback. We’ll work on packing it up into a self-contained zip package like the webcam demo is.

---

<div class="post-metadata">

### Author: ![HelicoptersofDC](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/helicoptersofdc/32/369_2.png) [@HelicoptersofDC](https://discuss.roboflow.com/u/HelicoptersofDC)
#### Post date: [June 1, 2022, 1:30pm UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/6 "2022-06-01T13:30:50Z")

</div>

hmmm now starting to get that same error on my FTP server:  
`Access to XMLHttpRequest at 'https://infer.roboflow.com/helicopters-of-dc-ghwuq/1?access_token=API_KEY&confidence=0.4&overlap=0.3&format=image&labels=on&stroke=2&image=https%3A%2F%2Fpbs.twimg.com%2Fmedia%2FFBL25GUX0AQSVRU.jpg' from origin 'MY_DOMAIN' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.`

---

<div class="post-metadata">

### Author: ![brad](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/brad/32/23_2.png) [@brad](https://discuss.roboflow.com/u/brad)
#### Post date: [June 1, 2022, 1:52pm UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/7 "2022-06-01T13:52:31Z")

</div>

Weird; do we have `infer.roboflow.com` in there somewhere still? It should be `detect.roboflow.com` unless this is an extremely old model.

Also is your API Key filled into that URL when you hit it? What happens if you navigate to the URL directly?

---

<div class="post-metadata">

### Author: ![HelicoptersofDC](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/helicoptersofdc/32/369_2.png) [@HelicoptersofDC](https://discuss.roboflow.com/u/HelicoptersofDC)
#### Post date: [June 1, 2022, 2:21pm UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/8 "2022-06-01T14:21:32Z")

</div>

working again, it was after I put the codepen JS in there, it reads:

```auto
	var parts = [
		"https://infer.roboflow.com/",
		$('#model').val(),
		"?access_token=" + $('#access_token').val()
	];

```

so not only [detect.roboflow.com](http://detect.roboflow.com) but that ?access\_token must now be ?api\_key

---

<div class="post-metadata">

### Author: ![HelicoptersofDC](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/helicoptersofdc/32/369_2.png) [@HelicoptersofDC](https://discuss.roboflow.com/u/HelicoptersofDC)
#### Post date: [June 6, 2022, 6:06pm UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/9 "2022-06-06T18:06:11Z")

</div>

So I still get a 503 error about half the time when using URL option - same with the stock form:

```auto

1. {method: 'POST', format: 'json', url: 'https://detect.roboflow.com/helicopters-of-dc-ghwu…son&image=https%3A%2F%2Fi.imgur.com%2FpHRqwOI.jpg'}

  1. error: ƒ (xhr)
  2. format: "json"
  3. method: "POST"
  4. url: "https://detect.roboflow.com/helicopters-of-dc-ghwuq/1?api_key=API_KEY_REDACTED&confidence=40&overlap=30&format=json&image=https%3A%2F%2Fi.imgur.com%2FpHRqwOI.jpg"
  5. [[Prototype]]: Object

jquery.min.js:2 POST https://detect.roboflow.com/helicopters-of-dc-ghwuq/1?api_key=API_KEY_REDACTED&confidence=40&overlap=30&format=json&image=https%3A%2F%2Fi.imgur.com%2FpHRqwOI.jpg 503

```

| | send | @ | jquery.min.js:2 |
| --- | --- | --- | --- |
| | ajax | @ | jquery.min.js:2 |
| | (anonymous) | @ | ?model=helicopters-o…GtJyLRjdtKqh5bw:437 |
| | getSettingsFromForm | @ | ?model=helicopters-o…GtJyLRjdtKqh5bw:593 |
| | infer | @ | ?model=helicopters-o…GtJyLRjdtKqh5bw:426 |
| | (anonymous) | @ | ?model=helicopters-o…GtJyLRjdtKqh5bw:492 |
| | dispatch | @ | jquery.min.js:2 |
| | v.handle | @ | jquery.min.js:2 |

---

<div class="post-metadata">

### Author: ![Mohamed](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/mohamed/32/62_2.png) [@Mohamed](https://discuss.roboflow.com/u/Mohamed)
#### Post date: [June 6, 2022, 8:19pm UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/10 "2022-06-06T20:19:26Z")

</div>

Hi @HelicoptersofDC - can you send a copy of the full code you’re using for inference (and the image used for inference) to [help@roboflow.com](mailto:help@roboflow.com)? I’d like to run some tests to diagnose the error.

You can also choose to link the files here if your API key is removed from the inference code.

---

<div class="post-metadata">

### Author: ![HelicoptersofDC](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/helicoptersofdc/32/369_2.png) [@HelicoptersofDC](https://discuss.roboflow.com/u/HelicoptersofDC)
#### Post date: [June 6, 2022, 8:52pm UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/11 "2022-06-06T20:52:42Z")

</div>

For now I’m going to rely on file upload - I will work you guys up some code when I have time, was having a similar problem with Python so I’d like to get you some detailed logs.

---

<div class="post-metadata">

### Author: ![abdullahmadawi](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/abdullahmadawi/32/2366_2.png) [@abdullahmadawi](https://discuss.roboflow.com/u/abdullahmadawi)
#### Post date: [July 13, 2023, 7:17am UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/12 "2023-07-13T07:17:22Z")

</div>

Hi guys. I’ve encountered the same issue. Wondering if there has been any update to the codepen demo.  
Thanks.

---

<div class="post-metadata">

### Author: ![leo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/leo/32/2228_2.png) [@leo](https://discuss.roboflow.com/u/leo)
#### Post date: [July 14, 2023, 2:20am UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/13 "2023-07-14T02:20:20Z")

</div>

@abdullahmadawi could you elaborate on what issue are you experiencing? Is it the error message the original poster mentioned about `Error loading response. Check your API key, model, version, and other parameters then try again.`? Are you trying to run the web app locally?

---

<div class="post-metadata">

### Author: ![abdullahmadawi](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/abdullahmadawi/32/2366_2.png) [@abdullahmadawi](https://discuss.roboflow.com/u/abdullahmadawi)
#### Post date: [July 17, 2023, 5:15am UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/14 "2023-07-17T05:15:54Z")

</div>

Hi,

Thanks for responding. I managed to resolve my issue which was similar to this comment:

> [@Having trouble running sample web app locally](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/8):
>
> working again, it was after I put the codepen JS in there, it reads: var parts = ["https://infer.roboflow.com/", $('#model').val(), "?access\_token=" + $('#access\_token').val()]; so not only [detect.roboflow.com](http://detect.roboflow.com) but that ?access\_token must now be ?api\_key

The format of my parameters in the codepen demo did not match those in the actual demo. I’m not sure if this makes sense.

Before:

```auto
	var parts = [
		"https://infer.roboflow.com/",
		$('#model').val(),
		"?access_token=" + $('#access_token').val()
	];

```

After:

```auto
var parts = [
		"https://detect.roboflow.com/",
		$('#model').val(),
		"/",
		$('#version').val(),
		"?",
		"api_key=" + $('#api_key').val()
	];

```

Once the corrections were made the codepen demo worked.

Thanks.

---

<div class="post-metadata">

### Author: ![leo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/leo/32/2228_2.png) [@leo](https://discuss.roboflow.com/u/leo)
#### Post date: [July 17, 2023, 10:25pm UTC](https://discuss.roboflow.com/t/having-trouble-running-sample-web-app-locally/514/15 "2023-07-17T22:25:09Z")

</div>

Hi @abdullahmadawi

It’s great to hear that your issues were able to be resolved. I’ll make sure that gets updated. Thanks for sharing!
