Replies: 3 comments
-
Check for root_path in uvicorn
Le ven. 4 oct. 2019 à 12:51 AM, Romiko Derbynew <[email protected]>
a écrit :
… *Description*
We have an application gateway where apps are routed by path e.g.
apps.romiko.com/app1/web
apps.romiko.com/app1/api
apps.romiko.com/app2/web
apps.romiko.com/app2/api
How can I [...]?
We notice with the routing urls that the path is added twice.
e.g.
mysite/app1/api/app1/api
Is it possible to [...]?
Have a configuration option to set the root level of the site e.g.
app.UsePathBase("/app1/app2");
*Additional context*
Request URL: https://app.romiko.com.au/coldstream-api/coldstream-api/tags
Request Method: GET
Status Code: 500 Internal Server Error
Remote Address: 200.10.128.4:443
Referrer Policy: no-referrer-when-downgrade
Connection: keep-alive
Content-Length: 21
Content-Type: text/plain; charset=utf-8
Date: Thu, 03 Oct 2019 22:47:33 GMT
server: uvicorn
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,
*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Authorization: Basic xyz
Cache-Control: max-age=0
Connection: keep-alive
Host: app.romiko.com.au
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
*Stack Trace - Internal Server Error 500*
[2019-10-03 10:37:42 +0000] [8] [ERROR] Exception in ASGI application
Traceback (most recent call last):
File
"/usr/local/lib/python3.7/site-packages/uvicorn/protocols/http/httptools_impl.py",
line 375, in run_asgi
result = await app(self.scope, self.receive, self.send)
File
"/usr/local/lib/python3.7/site-packages/uvicorn/middleware/message_logger.py",
line 58, in *call*
raise exc from None
File
"/usr/local/lib/python3.7/site-packages/uvicorn/middleware/message_logger.py",
line 54, in *call*
await self.app(scope, inner_receive, inner_send)
File "/usr/local/lib/python3.7/site-packages/starlette/applications.py",
line 133, in *call*
await self.error_middleware(scope, receive, send)
File
"/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py",
line 177, in *call*
raise exc from None
File
"/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py",
line 155, in *call*
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py",
line 73, in *call*
raise exc from None
File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py",
line 62, in *call*
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line
590, in *call*
await route(scope, receive, send)
File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line
208, in *call*
await self.app(scope, receive, send)
File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line
41, in app
response = await func(request)
File "/usr/local/lib/python3.7/site-packages/fastapi/routing.py", line
111, in app
raw_response = await dependant.call(**values)
File "/app/coldstream/coldstream.py", line 251, in fetch_tags
cursor.execute(QUERIES['fetch_tags'], (offset, limit))
TypeError: execute() takes 1 positional argument but 3 were given
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#588?email_source=notifications&email_token=AAINSPV4JJ3BSZL4FJOTGRLQMZZPBA5CNFSM4I5JDPX2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HPRB4NA>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAINSPSA46WYR5PRBAYNH5DQMZZPBANCNFSM4I5JDPXQ>
.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Hmm, it's difficult to guess what can be wrong, can you please share a self-contained example of the misbehavior? Are you running multiple apps or just one? What's the value is the Do you have a proxy on top of your app? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
We have an application gateway where apps are routed by path e.g.
apps.romiko.com/app1/web
apps.romiko.com/app1/api
apps.romiko.com/app2/web
apps.romiko.com/app2/api
How can I [...]?
We notice with the routing urls that the path is added twice.
e.g.
mysite/app1/api/app1/api
Is it possible to [...]?
Have a configuration option to set the root level of the site e.g.
app.UsePathBase("/app1/app2");
Additional context
Request URL: https://app.romiko.com.au/coldstream-api/coldstream-api/tags
Request Method: GET
Status Code: 500 Internal Server Error
Remote Address: 200.10.128.4:443
Referrer Policy: no-referrer-when-downgrade
Connection: keep-alive
Content-Length: 21
Content-Type: text/plain; charset=utf-8
Date: Thu, 03 Oct 2019 22:47:33 GMT
server: uvicorn
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Authorization: Basic xyz
Cache-Control: max-age=0
Connection: keep-alive
Host: app.romiko.com.au
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
Sample Code
`# Coldstream globals
SCOPE = environ.get("SCOPE", "/coldstream-api/v1")
...
.....
app = FastAPI(
title="Coldstream",
description="A webservice to protect production Azure SQL.",
version=version,
openapi_url=SCOPE + "/openapi.json",
docs_url=SCOPE + "/docs",
redoc_url=SCOPE + "/redoc"
)
...
...
@app.get(
SCOPE + "/tags",
response_model=List[Tag],
response_model_skip_defaults=True,
tags=["Tags"],
response_class=UJSONResponse,
)
`
Beta Was this translation helpful? Give feedback.
All reactions