eduardoboucas / staticman

💪 User-generated content for Git-powered websites
https://staticman.net
MIT License
2.41k stars 534 forks source link

"errorCode":"GITLAB_READING_FILE"} #459

Closed paolocornali85it closed 1 year ago

paolocornali85it commented 1 year ago

I start by saying that I'm not a developer and this is the first issue I create. When I try to submit a comment, I receive the following error: {"success":false,"rawError":{"message":"404 - {\"message\":\"404 Project Not Found\"}","statusCode":404},"errorCode":"GITLAB_READING_FILE"}

Context:

2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] (node:545) UnhandledPromiseRejectionWarning: Error: Require an oauthToken or token option
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at GitHub (/app/lib/GitHub.js:33:15)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at new GitHub (/app/lib/GitHub.js:46:7)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at Object.module.exports.create (/app/lib/GitServiceFactory.js:11:14)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at Staticman (/app/lib/Staticman.js:32:35)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at new Staticman (/app/lib/Staticman.js:46:7)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at module.exports (/app/controllers/process.js:126:27)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at next (/app/node_modules/express/lib/router/route.js:144:13)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at /app/server.js:169:14
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at next (/app/node_modules/express/lib/router/route.js:144:13)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at /app/server.js:129:14
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at next (/app/node_modules/express/lib/router/route.js:144:13)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at module.exports.<anonymous> (/app/node_modules/express-brute/index.js:142:36)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at module.exports.MemoryStore.set (/app/node_modules/express-brute/lib/MemoryStore.js:28:35)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at module.exports.<anonymous> (/app/node_modules/express-brute/index.js:127:17)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at module.exports.MemoryStore.get (/app/node_modules/express-brute/lib/MemoryStore.js:38:35)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at module.exports.<anonymous> (/app/node_modules/express-brute/index.js:82:15)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at keyFunc (/app/node_modules/express-brute/index.js:39:41)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at module.exports.<anonymous> (/app/node_modules/express-brute/index.js:47:3)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2023-04-28T04:45:27.622 app[c2b9b91a] ams [info] (node:545) 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: 219)
2023-04-28T04:46:27.621 proxy[c2b9b91a] ams [error] could not make HTTP request to instance: connection error: timed out

Anyone can help? Thank you in advance.

lysng commented 1 year ago

Hey @paolocornali85it, I don't use gitlab but from reading the error message it says that the ssage":"404 - {\"message\":\"404 Project Not Found\". This likely means that staticman unlikely can't see or find your project.

I also looked at your: https://gitlab.com/paolocornali85it/staticman_test/-/blob/main/config.toml and you don't seem to reference your hosted staticman at all. From my understanding it should look like this:

[params.comments.staticman]
enable = true
apiEndpoint = "https://{your_hosted_staticman}.fly.dev/v2/entry"
maxDepth = 4
username = "{relevant_username}"
repository = "{relevant_repo_name}"

Try this out + good luck!

paolocornali85it commented 1 year ago

Hi lysng, thank you for your answer. After various attemps, I am now able to submit a comment. The problem was that the gitlab token I have set disappeared. Probably it was expired and I hadn't noticed it. When I recreate the gitlab token, it started to works.