# Prodigy returning 403 in Browser's developer console

**URL:** <https://support.prodi.gy/t/prodigy-returning-403-in-browsers-developer-console/6417>\
**Category:** Uncategorized\
**Tags:** usage, aws, server\
**Created:** [March 7, 2023, 10:23am UTC](https://support.prodi.gy/t/prodigy-returning-403-in-browsers-developer-console/6417 "2023-03-07T10:23:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sparsh-kedia](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/sparsh-kedia/32/3659_2.png) [@sparsh-kedia](https://support.prodi.gy/u/sparsh-kedia)\
**Post date:** [March 7, 2023, 10:23am UTC](https://support.prodi.gy/t/prodigy-returning-403-in-browsers-developer-console/6417/1 "2023-03-07T10:23:42Z")

</div>

EC2 instance was recently moved from public to private subnet. Since then, the prodigy service is broken.

Login mechanism - login to ec2, port forwarded to port 8080, host the job using the prodigy command, hosting is successful.

When i open the browser and send a request to localhost:8080, it opens the prodigy UI but the content isn't loaded and a message appears - `"ERROR:Can't fetch project. Make sure the server is running correctly."` Upon checking the browser's developer console - I saw a 403 response from `localhost:8080/project`.

I am attaching the relevant screenshots. Can someone help here and share any possible fixes or resolutions?

 ![error2](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/a/abbc87964d5f1eddb0c97fac3180c72e88f1619d.jpeg)  
 ![error1](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/3/3101cf270f66cb9b75a08cebb9e180a1c0b007e8.jpeg)

---

<div class="post-metadata">

**Author:** ![ryanwesslen](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ryanwesslen/32/2969_2.png) [@ryanwesslen](https://support.prodi.gy/u/ryanwesslen)\
**Post date:** [March 8, 2023, 1:24pm UTC](https://support.prodi.gy/t/prodigy-returning-403-in-browsers-developer-console/6417/2 "2023-03-08T13:24:50Z")

</div>

hi @sparsh-kedia!

Thanks for your question and welcome to the Prodigy community 👋

> [@sparsh-kedia](#):
>
> When i open the browser and send a request to localhost:8080, it opens the prodigy UI but the content isn't loaded and a message appears - `"ERROR:Can't fetch project. Make sure the server is running correctly."`

Could you check your Network tab in the browser? There might be more info on why the request failed, rather than just the console line.

Typically, a 403 should only happen if there's a [JWT](https://auth0.com/docs/secure/tokens/json-web-tokens) error. Have you modified any JWT settings?

If not, one possibility is that JWT cookie can't be reached due to something [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) related, then the token isn't set on the request AUTHORIZATION header so the 403 appears.

But if it were a CORS problem, we'd expect to see a CORS warning and then the failed request.

To test if this is the problem, can you try setting `"cors": false` in `prodigy.json`. It's not really recommended to turn that off but they could determine if it is a CORS issue through that test. If this does seem to be the issue, you can set the `PRODIGY_CORS_ORIGIN` env var with the proper URLS for CORS.

One other possibility is to try to modify your `"host"` in [`prodigy.json`](https://prodi.gy/docs/install#config) from `"localhost"` to either `"127.0.0.1"` or `"0.0.0.0"`. However, this is usually a fix for a different, but somewhat related error: `OSError: [Errno 99] Cannot assign requested address`:

> [@OSError: \[Errno 99\] Cannot assign requested address](https://support.prodi.gy/t/oserror-errno-99-cannot-assign-requested-address/89/3):
>
> So I was poking at this further and I noticed I’m only able to get this working when I use host “0.0.0.0”. With “127.0.0.1” the app starts without crashing but I can’t connect to it from a browser. Some additional information. I’m running this in a docker container on my laptop. Networking is also not my strongest suite but usually when I run into these kinds of issues switching to 0.0.0.0 fixes things slight_smile Here’s my Dockerfile: FROM python:stretch MAINTAINER Michael Becker ENV PYT…

Last, another user had a somewhat similar 403 issue with the same Prodigy error message `ERROR:Can't fetch project ...`. Seemed like they forgot to pass a `session_id` which would be required if you set `PRODIGY_ALLOWED_SESSIONS` in your `prodigy.json`. Any chance this could be the problem?

> [@Could not fetch project if I run in docker](https://support.prodi.gy/t/could-not-fetch-project-if-i-run-in-docker/4338/4):
>
> Figured out the issue, it was because I didn't pass the session id.

---

<div class="post-metadata">

**Author:** ![sparsh-kedia](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/sparsh-kedia/32/3659_2.png) [@sparsh-kedia](https://support.prodi.gy/u/sparsh-kedia)\
**Post date:** [April 11, 2023, 7:29am UTC](https://support.prodi.gy/t/prodigy-returning-403-in-browsers-developer-console/6417/3 "2023-04-11T07:29:42Z")

</div>

@ryanwesslen I tried the following things -

1. Went to the network tab in my browser and am attaching my screenshot here. There is 403 error visible at fetch request.

 ![network_tab](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/8/86c0f08d576d5fe785d72c9ff5fa1f84d655e705.png)

1. I set "cors" as false in prodigy.json and saw no difference in the output in the network tab. I suspect that it's not a cors issue.

 ![cors_network_tab](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/9/992932d6a18f86ea09943d7fa287421483e8adc9.png)

1. "localhost" in prodigy.json is already set as "0.0.0.0" so it doesn't seem to be the issue.

 ![prodigy_json](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/c/c09be55af79b2598d9b5a9935ad14a76a10394c5.jpeg)

1. I haven't passed PRODIGY\_ALLOWED\_SESSIONS so that doesn't seem to be applicable in this case.

Do you have any other ideas or any other things i can help you with?

---

<div class="post-metadata">

**Author:** ![ryanwesslen](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ryanwesslen/32/2969_2.png) [@ryanwesslen](https://support.prodi.gy/u/ryanwesslen)\
**Post date:** [April 13, 2023, 5:06pm UTC](https://support.prodi.gy/t/prodigy-returning-403-in-browsers-developer-console/6417/4 "2023-04-13T17:06:42Z")

</div>

hi @sparsh-kedia,

The `/project` route is a simple handler with two opportunities to return a 403:

```python
@routes.get("/project")
def get_project():
    log("GET: /project", get_config())
    assert_known_session(None)
    config = {}
    for key, value in get_config().items():
        if srsly.is_json_serializable(value):
            config[key] = value
    return config

```

1. The `assert_known_session` checks the `PRODIGY_ALLOWED_SESSIONS` env variable, if this is set and a valid sessionId is not provided matching one of these allowed sessions, you get a 403
2. If JWT is manually turned on (e.g. with the ENV VAR `PRODIGY_JWT=1`) and Prodigy can't find the JWT token in the browsers cookies (it's there by default) then you get a 403.

There is not another opportunity in our code to return 403.

At one point FastAPI raised a 403 for HTTP Basic Auth but that likely changed at some point (not sure when).

What version of Prodigy are you using? You can provide the print out of `python -m prodigy stats`.

Can you also share the message you're seeing by clicking the failing request? It could give a hint.

Prodigy sends some messages back with 403 errors so the response would have an extra hint.

---

<div class="post-metadata">

**Author:** ![sparsh-kedia](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/sparsh-kedia/32/3659_2.png) [@sparsh-kedia](https://support.prodi.gy/u/sparsh-kedia)\
**Post date:** [April 17, 2023, 7:07am UTC](https://support.prodi.gy/t/prodigy-returning-403-in-browsers-developer-console/6417/5 "2023-04-17T07:07:43Z")

</div>

> [@ryanwesslen](#):
>
> python -m prodigy stats

@ryanwesslen Attached above is the output of the prodigy stats command.

============================== ✨ Prodigy Stats ==============================

Version 1.11.8  
Location /home/ubuntu/miniconda3/envs/prodigy\_env/lib/python3.10/site-packages/prodigy  
Prodigy Home /home/ubuntu/.prodigy  
Platform Linux-4.4.0-1128-aws-x86\_64-with-glibc2.23  
Python Version 3.10.4  
Database Name SQLite  
Database Id sqlite  
Total Datasets 93  
Total Sessions 538

Attached below is the message which I get by clicking the failing request.

 ![Screenshot 2023-04-17 at 12.35.28 PM](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/1/1b25cfd537551b8f625a744468f91a5d7d13e1c0.jpeg)

---

<div class="post-metadata">

**Author:** ![ryanwesslen](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ryanwesslen/32/2969_2.png) [@ryanwesslen](https://support.prodi.gy/u/ryanwesslen)\
**Post date:** [April 17, 2023, 12:30pm UTC](https://support.prodi.gy/t/prodigy-returning-403-in-browsers-developer-console/6417/6 "2023-04-17T12:30:23Z")

</div>

Ah - the error is "a registered session id is required for this task".

Yep, that's telling you the problem. You're trying to use [named multi-user sessions](https://prodi.gy/docs/api-web-app#multi-user-sessions) but not naming your session. It is the same problem that I mentioned earlier that another user had solved.

> [@ryanwesslen](#):
>
> Last, another user had a somewhat similar 403 issue with the same Prodigy error message `ERROR:Can't fetch project ...`. Seemed like they forgot to pass a `session_id` which would be required if you set `PRODIGY_ALLOWED_SESSIONS` in your `prodigy.json`. Any chance this could be the problem?
> 
> > [@](#):
> >
> > Figured out the issue, it was because I didn't pass the session id.

You need to add `?session=[name your session]` to your URL. You could also turn off your config settings (e.g., go back to default of `feed_overlap: false`, remove `PRODIGY_ALLOWED_SESSIONS`, etc.) and it should work.

Does this make sense?
