docsql icon indicating copy to clipboard operation
docsql copied to clipboard

Server returns 404

Open caugner opened this issue 2 years ago • 7 comments

I tried running docsql in a checkout of mdn/content, but the started server just returns "Not found":

% ls                                                                                                                                                                                                               ✖ ✭
CODE_OF_CONDUCT.md README.md          files              netlify.toml       out                scripts
LICENSE.md         REVIEWING.md       meta               node_modules       package.json       yarn.lock
% node --version                                                                                                                                                                                             130 ↵ ✖ ✭
v16.15.0
% npx docsql --version                                                                                                                                                                                       130 ↵ ✖ ✭
1.0.0
% npx docsql -v ./files                                                                                                                                                                                      130 ↵ ✖ ✭
Sources are: ./files
5 plugins found.
7,206 files found in ./files.
Analyzing ████████████████████████████████████████ 100% | 7206/7206
> Ready on http://localhost:3000
image

Any tips what might cause it?

caugner avatar May 16 '22 19:05 caugner

Weird! It's just NextJS.

Screen Shot 2022-05-17 at 10 24 25 AM

Perhaps you have a Service Worker on localhost:3000 from another project. Try different browsers or curl. E.g.

▶ xh --headers http://localhost:3000
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 7226
Content-Type: text/html;charset=utf-8
Date: Tue, 17 May 2022 14:25:14 GMT
Keep-Alive: timeout=5
Last-Modified: Mon, 28 Mar 2022 12:49:51 GMT

peterbe avatar May 17 '22 14:05 peterbe

Unfortunately, I'm getting the same result in a different browser (Edge) without Service Worker (as per edge://serviceworker-internals/), and with xh:

% xh --headers http://localhost:3000                                                                                                                                                        130 ↵ ✚
HTTP/1.1 404 Not Found
Connection: keep-alive
Content-Length: 9
Date: Tue, 17 May 2022 15:07:25 GMT
Keep-Alive: timeout=5

caugner avatar May 17 '22 15:05 caugner

Might sound silly but, are you sure there's nothing bound to :3000 before you start it?

peterbe avatar May 17 '22 18:05 peterbe

Yup, as soon as I terminate docsql, I no longer get any response and a timeout instead.

caugner avatar May 17 '22 19:05 caugner

Bummer. Would you mind debugging it to see why it could be? If I'm not mistaken, it's just polka running a folder called out. So perhaps it's a because you haven't run npm run build or npm run export which I thought was part of the NPM package.

peterbe avatar May 17 '22 19:05 peterbe

  • :x: Running npx docsql with relative or absolute path
  • :x: Running npm run run from docsql checkout with CONTENT_SOURCES in the environment
  • ✅ Running npm run dev from docsql checkout with CONTENT_SOURCES in the .env file

So the issue I'm experiencing could very well be the same as #80.

caugner avatar May 19 '22 09:05 caugner

I really suspect that the out directory is not being served correctly. It's certainly in the NPM package.

▶ npm init -y && npm install docsql
...

▶ ls node_modules/docsql/out/
404.html          _next             favicon-16x16.png favicon-32x32.png favicon.ico       index.html

Because when you try to run it now, it works:

▶ npx docsql /Users/peterbe/dev/MOZILLA/MDN/content/files
5 plugins found.
11,276 files found in /Users/peterbe/dev/MOZILLA/MDN/content/files.
Analyzing ████████████████████████████████████████ 100% | 11276/11276
> Ready on http://localhost:3000
^C

(yes, now http://localhost:3000 works)

So if you have some ideas how to make that work, I'm all ears.

peterbe avatar May 19 '22 19:05 peterbe