Bug #13851
Updated by Peter Amstutz over 6 years ago
<pre>
session_db.self-4814f5dc77cd9abd79a4cae265aa417dbb16c0dc7ab99fece07391fac5bcaf23.js?body=1:73 Uncaught TypeError: db.discoveryDoc(...).map(...).catch is not a function
at window.SessionDB.findAPI (session_db.self-4814f5dc77cd9abd79a4cae265aa417dbb16c0dc7ab99fece07391fac5bcaf23.js?body=1:73)
at HTMLFormElement.onsubmit (sessions.self-729bb276a57aec159a0bcdbb99ca42f47fc9bcf52a6e18a1c0b514727bcb4f5b.js?body=1:79)
at HTMLFormElement.callback (npm-dependencies.self-ad43882e3d5843bd283629f28ba745a7d3bde41937fa6e389b3ecd717d93ef6d.js?body=1:11776)
</pre>
This is because SessionDB.discoveryDoc is returning a mithril stream (m.stream()) but SessionDB.findAPI is expecting a Javascript Promise.
Also I ran into another problem in SessionDB.findAPI:
<pre>
return db.discoveryDoc({baseURL: url.origin}).map(function() {
</pre>
This is a problem because url.origin does not end in "/", but SessionDB.discoveryDoc calls m.request(session.baseURL+'discovery/v1/apis/arvados/v1/rest')
(this results in "http://example.com:8000discovery/v1/apis/arvados/v1/rest")
<pre>
- m.request(session.baseURL+'discovery/v1/apis/arvados/v1/rest')
+ var baseurl = session.baseURL;
+ if (baseurl[baseurl.length-1] != '/') {
+ baseurl += '/'
+ }
+ m.request(baseurl+'discovery/v1/apis/arvados/v1/rest')
</pre>