-
Notifications
You must be signed in to change notification settings - Fork 549
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
Error: Require an oauthToken
or token
option
#406
Comments
I found this blog post and issues #319 and #332. So it appears that v3 was never fixed to work with a githubToken. Thus I changed my API endpoint to v2. Be sure to remove the "github" part from the endpoint when changing from v3 to v2. This seems to work. I leave this issue open because
|
Essentially a dupe of eduardoboucas/staticman.net#15. The response to my linked issue says that a PR for backward compatibility with GitHub bot in v3 is pending. |
Not quite. eduardoboucas/staticman.net#15 is about the But thanks for pointing out that repo for the docs. I didn't see that earlier. |
Oops my bad, but from the linked issue, we see that there's a PR #405 that's suppose to support the legacy authorization method, even though a GitHub App is preferred. |
I tried again to use v3. I created a GitHub App and then added the vars But it still doesn't work and I get this error in the Heroku log:
This is exactly the error @hajekj mentioned in his blog. He wrote that you have to add I copied both the
|
I tried his advice too, but with no success. Finally I didn't escape the newline, as illustrated in my post in the discussion, and everything works fine. |
I tried that too. When I specify the key in multiple lines (copied the .pem file as is), then I got
|
@MichaelRumpler Note that the error If you follow the hashicorp/terraform-provider-tfe#164 |
I finally figured it out! I created the app, but forgot to install it. That must be done after the GitHub app was created in the menu Install App. The permissions should already be set before when you created it. You should then be able to see the app in your repositories settings in Integrations. And Yes, the GITHUB_PRIVATE_KEY must have newlines in Heroku. @hajekj deployed it to Azure, probably this recognizes \n and replaces it with newlines. I'll close this issue and probably add a PR for the docs at staticman.net. Thanks for all your help @VincentTam !! |
That's already in step 1 option 1 #3 in the quick start guide:
|
I had been hitting the same errors, so his was helpful. Thanks. To potentially add/clarify: When using the v3 + Github App + heroku method, I only got it to work when:
Strange that it is inconsistent. But, I tried every combo, and this is the only one that works. I think the official quick start guide is great, but I think this one line could be fleshed out: |
@RyanTG Thank you very much for your reply. This is the only thing that worked for me! Now I gotta fix my template. |
I tried to set up a staticman instance on Heroku, but I'm missing something.
The Heroku instance runs at https://staticman-mr.herokuapp.com/. When I open that url, it says "Hello from Staticman version 3.0.0!".
But when I try to submit a comment from my blog, then I get this in the Heroku log:
2021-03-01T17:34:37.714485+00:00 app[web.1]: /app/lib/GitHub.js:33
2021-03-01T17:34:37.714497+00:00 app[web.1]: throw new Error('Require an
oauthToken
ortoken
option')2021-03-01T17:34:37.714498+00:00 app[web.1]: ^
2021-03-01T17:34:37.714499+00:00 app[web.1]:
2021-03-01T17:34:37.714499+00:00 app[web.1]: Error: Require an
oauthToken
ortoken
option2021-03-01T17:34:37.714500+00:00 app[web.1]: at /app/lib/GitHub.js:33:15
2021-03-01T17:34:37.714500+00:00 app[web.1]: at new GitHub (/app/lib/GitHub.js:46:7)
2021-03-01T17:34:37.714501+00:00 app[web.1]: at Object.module.exports.create (/app/lib/GitServiceFactory.js:11:14)
2021-03-01T17:34:37.714501+00:00 app[web.1]: at /app/lib/Staticman.js:32:35
2021-03-01T17:34:37.714501+00:00 app[web.1]: at new Staticman (/app/lib/Staticman.js:46:7)
2021-03-01T17:34:37.714502+00:00 app[web.1]: at module.exports (/app/controllers/process.js:126:27)
2021-03-01T17:34:37.714503+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2021-03-01T17:34:37.714503+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2021-03-01T17:34:37.714504+00:00 app[web.1]: at /app/server.js:169:14
2021-03-01T17:34:37.714504+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2021-03-01T17:34:37.714504+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2021-03-01T17:34:37.714505+00:00 app[web.1]: at /app/server.js:144:14
2021-03-01T17:34:37.714505+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2021-03-01T17:34:37.714506+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2021-03-01T17:34:37.714506+00:00 app[web.1]: at /app/server.js:129:14
2021-03-01T17:34:37.714506+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2021-03-01T17:34:37.714507+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2021-03-01T17:34:37.714507+00:00 app[web.1]: at module.exports. (/app/node_modules/express-brute/index.js:142:36)
2021-03-01T17:34:37.714508+00:00 app[web.1]: at module.exports.MemoryStore.set (/app/node_modules/express-brute/lib/MemoryStore.js:28:35)
2021-03-01T17:34:37.714508+00:00 app[web.1]: at module.exports. (/app/node_modules/express-brute/index.js:127:17)
2021-03-01T17:34:37.714508+00:00 app[web.1]: at module.exports.MemoryStore.get (/app/node_modules/express-brute/lib/MemoryStore.js:38:35)
2021-03-01T17:34:37.714509+00:00 app[web.1]: at module.exports. (/app/node_modules/express-brute/index.js:82:15)
2021-03-01T17:34:37.732294+00:00 app[web.1]: npm ERR! code 1
2021-03-01T17:34:37.732902+00:00 app[web.1]: npm ERR! path /app
2021-03-01T17:34:37.739796+00:00 app[web.1]: npm ERR! command failed
2021-03-01T17:34:37.740081+00:00 app[web.1]: npm ERR! command sh -c node index.js
2021-03-01T17:34:37.754082+00:00 app[web.1]:
2021-03-01T17:34:37.754401+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-01T17:34:37.754634+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-01T17_34_37_741Z-debug.log
2021-03-01T17:34:37.722918+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=POST path="/v3/entry/github/MichaelRumpler/MichaelRumpler.github.io/master/comments" host=staticman-mr.herokuapp.com request_id=bc3aad82-ac22-434d-90f6-83a855d3fa4c fwd="77.116.29.22" dyno=web.1 connect=0ms service=45ms status=503 bytes=0 protocol=https
2021-03-01T17:34:37.822591+00:00 heroku[web.1]: Process exited with status 1
2021-03-01T17:34:37.910338+00:00 heroku[web.1]: State changed from up to crashed
I did set the Heroku config variables GITHUB_TOKEN and RSA_PRIVATE_KEY. From the error message I assume that it doesn't find the GITHUB_TOKEN.
When I go to github.com/settings/tokens of my Staticman App user, I see that the Personal Access Token was never used.
The text was updated successfully, but these errors were encountered: