simonw/datasette-app

All sorts of features not working due to bad HTTP requests

simonw opened this issue · 9 comments

Datasette Desktop 0.2.2 is a bad release!

  message: '127.0.0.1:52387 - "POST /-/open-csv-file/-/open-csv-file HTTP/1.1" 404 Not Found',
  type: 'stdout',
  ts: 2022-07-13T00:45:48.200Z
}
(node:23207) UnhandledPromiseRejectionWarning: Error: <!DOCTYPE html>
<html>
<head>
    <title>Error 404</title>
    <link rel="stylesheet" href="/-/static/app.css?cead5a">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

</head>

Note POST /-/open-csv-file/-/open-csv-file - this is happening for most of the menu-driven features. The release is broken.

I deleted the release and the tag.

I re-deployed https://datasette.io/ too which should remove the release from the site.

Clicking the about menu is a useful way to test this:

    at ResponseImpl.json (/Users/simon/Dropbox/Development/datasette-app/node_modules/electron-request/dist/index.js:634:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async DatasetteServer.openFile (/Users/simon/Dropbox/Development/datasette-app/main.js:106:26)
    at async App.<anonymous> (/Users/simon/Dropbox/Development/datasette-app/main.js:1149:5)
(Use `Electron --trace-warnings ...` to show where the warning was created)
(node:23207) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
{
  message: '127.0.0.1:52424 - "GET /-/versions.json/-/versions.json HTTP/1.1" 404 Not Found',

npm start already runs this:

"start": "DEBUGMENU=1 electron --trace-warnings --inspect=5858 .",

Added more logging to the about handler and got this:

{
  message: '127.0.0.1:52789 - "GET /-/versions.json/-/versions.json HTTP/1.1" 404 Not Found',
  type: 'stdout',
  ts: 2022-07-13T01:00:22.926Z
}
ResponseImpl {
  disturbed: false,
   ...
  config: {
    requestURL: 'http://localhost:8002/-/versions.json',
    statusCode: 404,
    headers: Headers {

Note that requestURL: 'http://localhost:8002/-/versions.json', but the hit goes to GET /-/versions.json/-/versions.json.

I'm suspicious of https://www.npmjs.com/package/electron-request - I tried upgrading it to the latest version but I'm still seeing the same bug.

I added electron-request here: 91b67a7 - it's worked since then though, so not sure how it could be at fault.

Oh this bug report looks suspicious:

Yes, that looks like it. Pinning to 1.7.1 fixes the bug, at least locally.

I pushed a new release (reusing the 0.2.2 version tag) and everything works now.