sitemap.xml is not generated because static/sitemap.xml does not exist.
JO3QMA opened this issue · 3 comments
JO3QMA commented
Summary
When trying to generate a sitemap using the Docker version ``wikijs-sitemap'', an error occurs if the file does not exist.
[[2023-12-19T15:06:59.006Z] Error generating sitemap (attempt 1/15): Error: Database connection error: ENOENT: no such file or directory, open 'static/sitemap.xml'
at generateSitemap (/wiki/sitemap/generate-sitemap.js:47:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async generateSitemapAndLog (/wiki/sitemap/server.js:40:13)
at async Server.<anonymous> (/wiki/sitemap/server.js:62:5)
Expected Behavior
sitemap.xml with the following content is generated.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<!-- Wiki.js sitemap generator by https://hostwiki.com -->
<url>
<loc>https://example.com/ja/hoge/fuga</loc>
<lastmod>2021-09-21T01:20:32.146Z</lastmod>
</url>
<url>
<loc>https://example.com/ja/foo</loc>
<lastmod>2022-02-18T13:39:07.843Z</lastmod>
</url>
<url>
<loc>https://example.com/ja/bar/fizz</loc>
<lastmod>2021-11-03T02:48:14.114Z</lastmod>
</url>
<url>
<loc>https://example.com/ja/buzz</loc>
<lastmod>2023-07-01T12:43:09.629Z</lastmod>
</url>
<url>
Actual Behavior
sitemap.xml not generated.
Error reading sitemap.xml file
with the error below
Server listening on port 3012
[[2023-12-20T00:09:27.130Z] Error generating sitemap (attempt 1/15): Error: Database connection error: ENOENT: no such file or directory, open 'static/sitemap.xml'
at generateSitemap (/wiki/sitemap/generate-sitemap.js:47:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async generateSitemapAndLog (/wiki/sitemap/server.js:40:13)
at async Server.<anonymous> (/wiki/sitemap/server.js:62:5)
[[2023-12-20T00:09:27.130Z] Error generating sitemap (attempt 2/15): Error: Database connection error: ENOENT: no such file or directory, open 'static/sitemap.xml'
at generateSitemap (/wiki/sitemap/generate-sitemap.js:47:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async generateSitemapAndLog (/wiki/sitemap/server.js:40:13)
at async Server.<anonymous> (/wiki/sitemap/server.js:62:5)
[[2023-12-20T00:09:27.130Z] Error generating sitemap (attempt 3/15): Error: Database connection error: ENOENT: no such file or directory, open 'static/sitemap.xml'
at generateSitemap (/wiki/sitemap/generate-sitemap.js:47:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async generateSitemapAndLog (/wiki/sitemap/server.js:40:13)
at async Server.<anonymous> (/wiki/sitemap/server.js:62:5)
[[2023-12-20T00:09:27.130Z] Error generating sitemap (attempt 4/15): Error: Database connection error: ENOENT: no such file or directory, open 'static/sitemap.xml'
at generateSitemap (/wiki/sitemap/generate-sitemap.js:47:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async generateSitemapAndLog (/wiki/sitemap/server.js:40:13)
at async Server.<anonymous> (/wiki/sitemap/server.js:62:5)
[Error: ENOENT: no such file or directory, open 'static/sitemap.xml'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'static/sitemap.xml'
}
[[2023-12-20T00:09:27.130Z] Error generating sitemap (attempt 5/15): Error: Database connection error: ENOENT: no such file or directory, open 'static/sitemap.xml'
at generateSitemap (/wiki/sitemap/generate-sitemap.js:47:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async generateSitemapAndLog (/wiki/sitemap/server.js:40:13)
at async Server.<anonymous> (/wiki/sitemap/server.js:62:5)
[Error: ENOENT: no such file or directory, open 'static/sitemap.xml'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'static/sitemap.xml'
}
Steps to Reproduce
- Configure docker-compose.yml according to README
- Start Docker
Environment
- Docker version 24.0.2, build cb74dfc
- Docker Compose version v2.16.0
- wikijs v2.5.300
- hostwiki/wikijs-sitemap:latest (As of 2023/12/20)
- PostgreSQL 11.22
JO3QMA commented
Work around
Enter the container, write the deleted sitemap.xml of 7b492ff, and restart it to generate it successfully.
$ docker-compose exec wikijs-sitemap /bin/sh
/wiki/sitemap # mkdir static
/wiki/sitemap # touch sitemap.xml
/wiki/sitemap # cat << EOF > ./static/sitemap.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
> <!-- Wiki.js sitemap generator by https://hostwiki.com -->
>
> </urlset>
> EOF
/wiki/sitemap # exit
$ docker-compose restart wikijs-sitemap
[+] Running 1/1
? Container wikijs-sitemap Started 11.4s
$
Philipinho commented
a5ee785 should fix this.
JO3QMA commented
thank you.
It's working perfectly.