# Ray serve routing issue

**URL:** https://discuss.ray.io/t/ray-serve-routing-issue/2080
**Category:** Ray Serve
**Created:** [May 7, 2021, 8:31am UTC](https://discuss.ray.io/t/ray-serve-routing-issue/2080 "2021-05-07T08:31:21Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![hbeybutyan](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/hbeybutyan/32/958_2.png) [@hbeybutyan](https://discuss.ray.io/u/hbeybutyan)
#### Post date: [May 7, 2021, 8:31am UTC](https://discuss.ray.io/t/ray-serve-routing-issue/2080/1 "2021-05-07T08:31:21Z")

</div>

Hey all

I have the following issue:

I am running the following code:

#############################################  
import ray  
from ray import serve  
from allennlp.predictors.predictor import Predictor  
from transformers import BertTokenizer  
from flask import Flask

def predict\_remote(request):  
try:  
data = request.get\_data(as\_text=True)  
itms = ray.get([predictor\_id, tokenizer\_id])  
tok = itms[1]  
pr = itms[0]  
train\_encoding = tok(data)  
train\_encoding = crop(train\_encoding[‘input\_ids’])  
inp = tok.decode(train\_encoding)  
probs = pr.predict(inp)[‘probs’]  
return probs  
except Exception as e:  
return "Problem detected

# Ray initialization, serve registration.

ray.init(\_memory=6 \* 10\*\*7)  
client = serve.start(detached=True)

# Backends and endpoints registration.

predictor = Predictor.from\_path(“/app/models/stanford-sentiment-treebank-roberta.2021-03-11.tar.gz”)  
tokenizer = BertTokenizer.from\_pretrained(“bert-base-cased”, do\_lower\_case=False)  
predictor\_id = ray.put(predictor)  
tokenizer\_id = ray.put(tokenizer)

client.create\_backend(“prediction\_backend”, predict\_remote)  
client.create\_endpoint(“prediction\_endpoint”, backend=“prediction\_backend”, methods=[‘POST’], route=“/api/v1/sentallen”)

# Register a health endpoint.

app = Flask( **name** )

@app.route(‘/api/v1/health’)  
def health():  
return client.list\_endpoints()

app.run(host=‘0.0.0.0’, port=8086)  
#################################################

Ones this is ran, I am getting the issue with the routing of endpoint. When I try to make a request it returns with (not always):  
“Path /api/v1/sentallen not found. Please ping http://…/-/routes for routing table”

The GET request to mentioned endpoint return with empty json.  
At the same time GET request to “api/v1/health” endpoint returns the single endpoint api/v1/snetallen.

Looks like a http proxy issue.  
Can someone look into this?  
Thanks

---

<div class="post-metadata">

### Author: ![hbeybutyan](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/hbeybutyan/32/958_2.png) [@hbeybutyan](https://discuss.ray.io/u/hbeybutyan)
#### Post date: [May 12, 2021, 7:11am UTC](https://discuss.ray.io/t/ray-serve-routing-issue/2080/2 "2021-05-12T07:11:17Z")

</div>

Turns out there is a Ray instance running in my local machine, though “ray stop” reports all the processes being stopped. Looks like this causes the issue.
