# Problem with rest for Rasa running in Docker on GCP

**URL:** <https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317>\
**Category:** Rasa Open Source\
**Created:** [February 26, 2020, 2:09pm UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317 "2020-02-26T14:09:27Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![noran](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/noran/32/7354_2.png) [@noran](https://forum.rasa.com/u/noran)\
**Post date:** [February 26, 2020, 2:09pm UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/1 "2020-02-26T14:09:27Z")

</div>

Hey Everyone,

I’m very new to rasa so please excuse potential beginner mistakes. So I have a problem communicating with my fresh installed rasa instance in my GCP VM. I’ve tried multiple things and don’t know where I’m wrong so I’m gonna explain everything I’ve done.

I created a new ubuntu 16.04 LTS VM on GCP matching the minimum requirements for rasa x and installed docker and docker-compose. Then I ran `sudo docker run --user root -v $(pwd):/app rasa/rasa init --no-prompt` to create the base project and train the first model. I have to do everything with root otherwise I’m having problems with permissions.

I checked all the files and folders in the project directory. Specifically that credentials.yml contains “rest:”.

Then I created docker-compose.yml :

```
version: '2.0' // Didn't work with 3.0
services:
  rasa:
    image: rasa/rasa
    ports:
      - 5005:5005
    volumes:
      - ./:/app
    command:
      - run

```

Then I ran `sudo docker-compose up -d` and checked that everything works with `sudo docker container ls` output of that is:

```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cc1677b364a9 rasa/rasa "rasa run" 2 minutes ago Up 7 seconds 0.0.0.0:5005->5005/tcp rasa_rasa_1

```

To me that looks good but when I run

`curl --location --request POST 'http://localhost:5005/webhooks/rest/webhook?sender=Rasa&message=Hi,%20there%21`

I only get:

```
<h1>Internal Server Error</h1>
<p>
    The server encountered an internal error and cannot complete
    your request.
</p>

```

And to even get this far took me ages. Previously it just refused the connection. Whenever I try to send the same message from a different network via `curl --location --request POST 'http://GcpExternalIP:5005/webhooks/rest/webhook?sender=Rasa&message=Hi,%20there%21` it just times out after a few seconds. I’ve tried Postman on mac, rested (similar to Postman used it before I knew of Postman) and terminal. I’ve tried installing rasa x on the same instance after that and that worked flawlessly. I just followed the tutorial from the rasa masterclass and I could connect to rasa x via firefox but when I compare the running docker containers I couldn’t find a difference in connected networks. But how is it that rasa x is exposed but rasa running on port 5005 isn’t??

Any help is greatly appreciated I don’t know what else to try. Thanks in advance!

---

<div class="post-metadata">

**Author:** ![skjainmiah](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@skjainmiah](https://forum.rasa.com/u/skjainmiah)\
**Post date:** [April 6, 2020, 7:22am UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/2 "2020-04-06T07:22:08Z")

</div>

@noran did you solve the issue?

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [April 6, 2020, 7:51am UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/3 "2020-04-06T07:51:12Z")

</div>

Hi @noran @skjainmiah In local host the endpoint is [http://localhost](http://localhost/):/webhooks/rest/webhook

But things change a lot when you deploy on GCP, Before you use it you have to get an bearer access token by following method:

```auto
Your endpoint is :
 http://<your_ip>/api/auth

with Json Body as POST request: 

{
	"username": "your usename, usually its me",
	"password": "your password"
}

```

It will return something like this:

```auto
{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1c2VybmFtZSI6Im1lIiwiZXhwIjoxNTg2MTE1MDMxLCJ1c2VyIjp7InVzZXJuYW1lIjoibWUiLCJyb2xlcyI6WyJhZG1pbiJdLCJkYXRhIjpudWxsLCJhcGlfdG9rZW4iOiI2MjkzYWU5MDcxMmIyYjEwNzJjNTBmNmFkNTE2YjJlMmUzNTc1ZjE4In0sInNjb3BlcyI6WyJhY3R
---really long access token
pb25QcmVkaWN0aW9uOmNyZWF0ZSIsImFjdGlvblByZWRpY3Rpb246Z2V0IiwiYWN0aW9uczpjcmVhdGUiLCJhY3Rpb25zOmRlbGV0ZSIsImFjdGlvbnM6Z2V0IiwiYWN0aW9uczp1cGRhdGUiLCJhbGxFd
9tWCLbQtPGe8jDfxExLwLdcxvkF7s5DQail8gtt_60mLPAlNRKbWeR3zpJ8RFf_KOAqxXDcg9rrZO-g_hXRng1ePOFOyrOFlQLMp0IN4YwRgHhdbqIlypdw"
}

```

authentication curl request will be like this:

```auto
curl --location --request POST 'http://your_ip/api/auth' \
--header 'Content-Type: application/json' \
--data-raw '{
	"username": "your username",
	"password": "your password"
}'

```

Now use this bearer token as authentication to chat endpoint:

The endpoints to chat is

```auto
http://<your_ip>/api/chat

with body in Json as POST request:

{
      "message" : <your input string here>
}

```

with bearer token.

Your curl request will be like this:

```auto
curl --location --request POST 'http://your ip/api/chat' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1c2VybmFtZSI6Im1lIiwiZXhwIjoxNTg2MTE1MDMxLCJ1c2VyIjp7InVzZXJuYW1lIjoibWUiLCJyb2xlcyI6WyJhZG1pbiJdLCJkYXRhIjpudWxsLCJhcGlfdG9rZW4iOiI2MjkzYWU5MDcxMmIyYjEwNzJjNTBmNmFkNTE2YjJlMmUzNTc1ZjE4In0sInNjb3BlcyI6WyJhY3R
---really long access token
pb25QcmVkaWN0aW9uOmNyZWF0ZSIsImFjdGlvblByZWRpY3Rpb246Z2V0IiwiYWN0aW9uczpjcmVhdGUiLCJhY3Rpb25zOmRlbGV0ZSIsImFjdGlvbnM6Z2V0IiwiYWN0aW9uczp1cGRhdGUiLCJhbGxFd
9tWCLbQtPGe8jDfxExLwLdcxvkF7s5DQail8gtt_60mLPAlNRKbWeR3zpJ8RFf_KOAqxXDcg9rrZO-g_hXRng1ePOFOyrOFlQLMp0IN4YwRgHhdbqIlypdw' \
--header 'Content-Type: application/json' \
--data-raw '{
	"message": "hi"
}'

```

Refer to this for more documentation [HTTP API](https://rasa.com/docs/rasa-x/api/rasa-x-http-api/).

---

<div class="post-metadata">

**Author:** ![skjainmiah](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@skjainmiah](https://forum.rasa.com/u/skjainmiah)\
**Post date:** [April 6, 2020, 8:32am UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/4 "2020-04-06T08:32:35Z")

</div>

@athenasaurav can you help me in deploying my Rasa Chatbot in GCP. As I have no Idea about docker and GCP. My chatbot is ready and I am not getting exact way how to deploy it. I’m searching from 1 month.

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [April 6, 2020, 9:48am UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/5 "2020-04-06T09:48:12Z")

</div>

Yes sure. Have you watched rasa masterclass. Join me in this tutorial series : [https://youtu.be/BIvte\_9Jx4E](https://youtu.be/BIvte_9Jx4E).

I will be building an end to end chatbot tutorial

---

<div class="post-metadata">

**Author:** ![skjainmiah](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@skjainmiah](https://forum.rasa.com/u/skjainmiah)\
**Post date:** [April 6, 2020, 9:49am UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/6 "2020-04-06T09:49:39Z")

</div>

If I get any doubt in deployment can I ask you?

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [April 6, 2020, 9:50am UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/7 "2020-04-06T09:50:24Z")

</div>

Yes please, happy to help

---

<div class="post-metadata">

**Author:** ![noran](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/noran/32/7354_2.png) [@noran](https://forum.rasa.com/u/noran)\
**Post date:** [May 4, 2020, 6:32pm UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/8 "2020-05-04T18:32:07Z")

</div>

No, unfortunately not. I tried to circumvent it by using sockets instead of http post requests, but I’m not having that much luck with that either.

---

<div class="post-metadata">

**Author:** ![noran](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/noran/32/7354_2.png) [@noran](https://forum.rasa.com/u/noran)\
**Post date:** [May 4, 2020, 6:35pm UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/9 "2020-05-04T18:35:38Z")

</div>

Thank you very much for that detailed guide, really appreciate it. The first post requests asking for an access token worked flawlessly, but I couldn’t send any messages. I pasted the access token I got from the request into the other post request, but with the same message “hi” I’m just getting empty brackets like so `[]`

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [May 5, 2020, 3:23pm UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/10 "2020-05-05T15:23:25Z")

</div>

Did You added the access token as Bearer token in the authentication window om postman.

Can you post your curl request here?

---

<div class="post-metadata">

**Author:** ![noran](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/noran/32/7354_2.png) [@noran](https://forum.rasa.com/u/noran)\
**Post date:** [May 24, 2020, 12:48pm UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/12 "2020-05-24T12:48:35Z")

</div>

Okay so I got it to work now. Thanks for the great help. I actually just copied over your curl request. In the end I got it to work with postman, I didn’t know I could put in the access token in the authorisation panel, but this is much cleaner and easier than a curl request…

I think my whole docker-setup had some issues so I did a clean install and added the rest input channel to credential.yml, as that got removed somehow. Then my communication worked. In postman it said status 200, but I still only got the empty square brackets. The issue this time was on rasa’s side. I couldn’t activate a model because I had none, but I also couldn’t train, because it would only say nothing has changed. So I changed a few lines, pushed to git and could train and load the model.

Now everything is working again. Thanks again

---

<div class="post-metadata">

**Author:** ![Saraa\_m](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@Saraa\_m](https://forum.rasa.com/u/Saraa_m)\
**Post date:** [September 27, 2021, 12:15pm UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/13 "2021-09-27T12:15:37Z")

</div>

@athenasaurav i am facing similar issue in the deployment. Can you elaborate on the provided solution. My actions work fine if not containerized. But when containerized im unable to make HTTP request

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [September 27, 2021, 3:19pm UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/14 "2021-09-27T15:19:15Z")

</div>

Hello @Saraa_m , Happy to help you.

Can you please elobrate your issues and the method which you used? Are you deploying on some VM instance or on localhost? Are you using rasa x or rasa open source for deployment? Also please share your credentials.yml file

---

<div class="post-metadata">

**Author:** ![Saraa\_m](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@Saraa\_m](https://forum.rasa.com/u/Saraa_m)\
**Post date:** [October 4, 2021, 2:08pm UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/15 "2021-10-04T14:08:38Z")

</div>

@athenasaurav sure. I’m using rasa open source. Im containerizing the package to deploy in kubernetes. There is a rest api call which is failing to execute when i use docker-compose up but works fine if not using docker.

The error message is Internal Server Error. The server encountered an internal error and cannot complete your request. [cred.txt](https://forum.rasa.com/uploads/short-url/6zvUgHpBSLwzwJnfUnuBfTiQ0Jz.txt) (1.1 KB)

---

<div class="post-metadata">

**Author:** ![Saraa\_m](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@Saraa\_m](https://forum.rasa.com/u/Saraa_m)\
**Post date:** [October 5, 2021, 3:51pm UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/16 "2021-10-05T15:51:35Z")

</div>

@athenasaurav

I’m using rasa open source. Im containerizing the package to deploy in kubernetes. There is a rest api call which is failing to execute when i use docker-compose up but works fine if not using docker. The error message is Internal Server Error. The server encountered an internal error and cannot complete your request

credential.yml [cred.txt](https://forum.rasa.com/uploads/short-url/6zvUgHpBSLwzwJnfUnuBfTiQ0Jz.txt) (1.1 KB) adding my dockerfile as well for your reference. Thanks in advance [docker-compose.yaml](https://forum.rasa.com/uploads/short-url/km2E5SIf15cMIsDjvCUZwR98paw.yaml) (589 Bytes)

 ![Screenshot (191)](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/3X/e/8/e8b1d670cb9522025cef0ff014df13bfbe68eeec.png)please help me here!!

---

<div class="post-metadata">

**Author:** ![Saraa\_m](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@Saraa\_m](https://forum.rasa.com/u/Saraa_m)\
**Post date:** [October 6, 2021, 1:16pm UTC](https://forum.rasa.com/t/problem-with-rest-for-rasa-running-in-docker-on-gcp/25317/18 "2021-10-06T13:16:05Z")

</div>

My Issue is fixed. My bad I was missing a file in the container and now rectified the same. 🙂Thanks!!!
