janitor
janitor copied to clipboard
Janitor proxy is broken: TypeError [ERR_INVALID_URL]: Invalid URL
When upgrading Palmaria and Pianosa to 221311f63d17f1e0890132506baaa7b8955587f1 (and Node 10), we get this error in the authentication flow:
(node:15527) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_URL]: Invalid URL: /abcdef0123456789/8089/ide.html?code=1234567890&state=1234567890
at onParseError (internal/url.js:240:17)
at parse (internal/url.js:249:3)
at new URL (internal/url.js:324:5)
at Array.handleOAuth2Code (/home/jan/janitor/join.js:138:22)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:15527) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15527) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Looks like you can't do new URL(request.url), because request.url is something like /index.html while new URL() seems to expect something like http://domain.com/index.html.
Hot-fixed in production by reverting the latest commit on Palmaria and Pianosa.
Cc @nt1m please have a look when you have time. :smile:
@jankeromnes You can do new URL(request.url, baseURL)