[v16] request fails with 500 server response and 404 not found page
clicktrend opened this issue · 2 comments
clicktrend commented
I'm using doodba template to run odoo 16 with demo data.
Installation procedure:
copier copy gh:Tecnativa/doodba-copier-template rest_test
invoke develop img-pull img-build git-aggregate resetdb start
# .copier-aswers.yml
_commit: v5.0.0
_src_path: gh:Tecnativa/doodba-copier-template
backup_deletion: false
backup_dst: null
backup_email_from: null
backup_email_to: null
backup_image_version: latest
backup_tz: UTC
cidr_whitelist: null
domains_prod: null
domains_test: null
gitlab_url: null
odoo_dbfilter: ^prod
odoo_initial_lang: en_US
odoo_listdb: false
odoo_oci_image: null
odoo_proxy: traefik
odoo_version: 16.0
paths_without_crawlers:
- /web
- /website/info
postgres_cidr_whitelist: null
postgres_dbname: prod
postgres_exposed: false
postgres_exposed_port: 5432
postgres_username: odoo
postgres_version: '14'
project_author: Tecnativa
project_license: BSL-1.0
project_name: myproject-odoo
smtp_canonical_default: null
smtp_canonical_domains: null
smtp_default_from: null
smtp_relay_host: null
smtp_relay_port: 587
smtp_relay_user: null
smtp_relay_version: '10'
# odoo/custom/src/repos.yaml
./odoo:
defaults:
# Shallow repositories ($DEPTH_DEFAULT=1) are faster & thinner
# You may need a bigger depth when merging PRs (use $DEPTH_MERGE
# for a sane value of 100 commits)
depth: $DEPTH_DEFAULT
remotes:
ocb: https://github.com/OCA/OCB.git
odoo: https://github.com/odoo/odoo.git
openupgrade: https://github.com/OCA/OpenUpgrade.git
target: ocb $ODOO_VERSION
merges:
- ocb $ODOO_VERSION
# Example of a merge of the PR with the number <PR>
# - oca refs/pull/<PR>/head
./sync-addons:
defaults:
# Shallow repositories ($DEPTH_DEFAULT=1) are faster & thinner
# You may need a bigger depth when merging PRs (use $DEPTH_MERGE
# for a sane value of 100 commits)
depth: $DEPTH_DEFAULT
remotes:
origin: https://github.com/itpp-labs/sync-addons.git
target: origin $ODOO_VERSION
merges:
- origin $ODOO_VERSION
# odoo/custom/src/addons.yaml
sync-addons:
- '*'
# odoo/custom/dependencies/pip.txt
git+https://github.com/OCA/openupgradelib.git@master
unicodecsv
unidecode
bravado-core
swagger_spec_validator
jsonschema>=3.2.0,<4
Request
curl -X 'GET' \
> 'http://localhost:16069/api/v1/demo/res.partner' \
> -H 'accept: application/json' \
> -H 'authorization: Basic dGVzdDo0MWQ2MDNkOC0zODA2LTQ4OGUtOGQzNS1hMGU0NGYyZWQ4OGM='
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. // Werkzeug Debugger</title>
<link rel="stylesheet" href="?__debugger__=yes&cmd=resource&f=style.css"
type="text/css">
<!-- We need to make sure this has a favicon so that the debugger does
not by accident trigger a request to /favicon.ico which might
change the application state. -->
<link rel="shortcut icon"
href="?__debugger__=yes&cmd=resource&f=console.png">
<script src="?__debugger__=yes&cmd=resource&f=jquery.js"></script>
<script src="?__debugger__=yes&cmd=resource&f=debugger.js"></script>
<script type="text/javascript">
var TRACEBACK = 139971816059376,
CONSOLE_MODE = false,
EVALEX = true,
EVALEX_TRUSTED = false,
SECRET = "1ng6KHKbmFUvcozokrsi";
</script>
</head>
<body style="background-color: #fff">
<div class="debugger">
<h1>werkzeug.exceptions.NotFound</h1>
<div class="detail">
<p class="errormsg">werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>
</div>
<h2 class="traceback">Traceback <em>(most recent call last)</em></h2>
<div class="traceback">
<ul><li><div class="frame" id="frame-139971816059184">
<h4>File <cite class="filename">"/opt/odoo/custom/src/odoo/odoo/http.py"</cite>,
line <em class="line">1995</em>,
in <code class="function">__call__</code></h4>
<div class="source "><pre class="line before"><span class="ws"> </span>response = request._serve_static()</pre>
<pre class="line before"><span class="ws"> </span>elif request.db:</pre>
<pre class="line before"><span class="ws"> </span>with request._get_profiler_context_manager():</pre>
<pre class="line before"><span class="ws"> </span>response = request._serve_db()</pre>
<pre class="line before"><span class="ws"> </span>else:</pre>
<pre class="line current"><span class="ws"> </span>response = request._serve_nodb()</pre>
<pre class="line after"><span class="ws"> </span>return response(environ, start_response)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"> </span>except Exception as exc:</pre>
<pre class="line after"><span class="ws"> </span># Valid (2xx/3xx) response returned via werkzeug.exceptions.abort.</pre>
<pre class="line after"><span class="ws"> </span>if isinstance(exc, HTTPException) and exc.code is None:</pre></div>
</div>
<li><div class="frame" id="frame-139971816059616">
<h4>File <cite class="filename">"/opt/odoo/custom/src/odoo/odoo/http.py"</cite>,
line <em class="line">1544</em>,
in <code class="function">_serve_nodb</code></h4>
<div class="source "><pre class="line before"><span class="ws"> </span>"""</pre>
<pre class="line before"><span class="ws"> </span>Dispatch the request to its matching controller in a</pre>
<pre class="line before"><span class="ws"> </span>database-free environment.</pre>
<pre class="line before"><span class="ws"> </span>"""</pre>
<pre class="line before"><span class="ws"> </span>router = root.nodb_routing_map.bind_to_environ(self.httprequest.environ)</pre>
<pre class="line current"><span class="ws"> </span>rule, args = router.match(return_rule=True)</pre>
<pre class="line after"><span class="ws"> </span>self._set_request_dispatcher(rule)</pre>
<pre class="line after"><span class="ws"> </span>self.dispatcher.pre_dispatch(rule, args)</pre>
<pre class="line after"><span class="ws"> </span>response = self.dispatcher.dispatch(rule.endpoint, args)</pre>
<pre class="line after"><span class="ws"> </span>self.dispatcher.post_dispatch(response)</pre>
<pre class="line after"><span class="ws"> </span>return response</pre></div>
</div>
<li><div class="frame" id="frame-139971816059568">
<h4>File <cite class="filename">"/usr/local/lib/python3.8/site-packages/werkzeug/routing.py"</cite>,
line <em class="line">1799</em>,
in <code class="function">match</code></h4>
<div class="source library"><pre class="line before"><span class="ws"> </span>else:</pre>
<pre class="line before"><span class="ws"> </span>return rule.endpoint, rv</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws"> </span>if have_match_for:</pre>
<pre class="line before"><span class="ws"> </span>raise MethodNotAllowed(valid_methods=list(have_match_for))</pre>
<pre class="line current"><span class="ws"> </span>raise NotFound()</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"> </span>def test(self, path_info=None, method=None):</pre>
<pre class="line after"><span class="ws"> </span>"""Test if a rule would match. Works like `match` but returns `True`</pre>
<pre class="line after"><span class="ws"> </span>if the URL matches, or `False` if it does not exist.</pre>
<pre class="line after"><span class="ws"></span> </pre></div>
</div>
</ul>
<blockquote>werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</blockquote>
</div>
<div class="plain">
<form action="/?__debugger__=yes&cmd=paste" method="post">
<p>
<input type="hidden" name="language" value="pytb">
This is the Copy/Paste friendly version of the traceback. <span
class="pastemessage">You can also paste this traceback into
a <a href="https://gist.github.com/">gist</a>:
<input type="submit" value="create paste"></span>
</p>
<textarea cols="50" rows="10" name="code" readonly>Traceback (most recent call last):
File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1995, in __call__
response = request._serve_nodb()
File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1544, in _serve_nodb
rule, args = router.match(return_rule=True)
File "/usr/local/lib/python3.8/site-packages/werkzeug/routing.py", line 1799, in match
raise NotFound()
werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</textarea>
</form>
</div>
<div class="explanation">
The debugger caught an exception in your WSGI application. You can now
look at the traceback which led to the error. <span class="nojavascript">
If you enable JavaScript you can also use additional features such as code
execution (if the evalex feature is enabled), automatic pasting of the
exceptions and much more.</span>
</div>
<div class="footer">
Brought to you by <strong class="arthur">DON'T PANIC</strong>, your
friendly Werkzeug powered traceback interpreter.
</div>
</div>
<div class="pin-prompt">
<div class="inner">
<h3>Console Locked</h3>
<p>
The console is locked and needs to be unlocked by entering the PIN.
You can find the PIN printed out on the standard output of your
shell that runs the server.
<form>
<p>PIN:
<input type=text name=pin size=14>
<input type=submit name=btn value="Confirm Pin">
</form>
</div>
</div>
</body>
</html>
<!--
Traceback (most recent call last):
File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1995, in __call__
response = request._serve_nodb()
File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1544, in _serve_nodb
rule, args = router.match(return_rule=True)
File "/usr/local/lib/python3.8/site-packages/werkzeug/routing.py", line 1799, in match
raise NotFound()
werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
-->
Swagger file (http://localhost:16069/api/v1/demo/swagger.json?token=demo_token&db=test) results in same response
curl -X 'GET' 'http://localhost:16069/api/v1/demo/swagger.json?token=demo_token&db=test'
File is shown correct if you're logged in odoo and open http://localhost:16069/api/v1/demo/swagger.json?token=demo_token&db=test in browser. I tried to debug it. The problem is that dbname is not set.
clicktrend commented
seems to be the same error #447
clicktrend commented
I got it work setting DB_FILTER in devel.yaml in environment