Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server returns 404 #107

Open
caugner opened this issue May 16, 2022 · 7 comments
Open

Server returns 404 #107

caugner opened this issue May 16, 2022 · 7 comments

Comments

@caugner
Copy link

caugner commented May 16, 2022

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?

@peterbe
Copy link
Owner

peterbe commented May 17, 2022

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

@caugner
Copy link
Author

caugner commented May 17, 2022

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

@peterbe
Copy link
Owner

peterbe commented May 17, 2022

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

@caugner
Copy link
Author

caugner commented May 17, 2022

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

@peterbe
Copy link
Owner

peterbe commented May 17, 2022

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.

@caugner
Copy link
Author

caugner commented May 19, 2022

  • ❌ Running npx docsql with relative or absolute path
  • ❌ 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.

@peterbe
Copy link
Owner

peterbe commented May 19, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants