Staticman: App error - Official staticman api on Heroku.

Created on 22 Feb 2020  Â·  77Comments  Â·  Source: eduardoboucas/staticman

When I try to send data to your API that works on Heroku, I get an "Application error" message just like in the picture.
unknown

You will restore an older version, or fix the hosting of your application on Heroku, because I think it's your fault, not my form.

bug question

Most helpful comment

@basemwahba You shouldn't be calling a GET request to that endpoint. The /entry endpoints are for posting comment forms to. If you are using a separate bot account (the account your GITHUB_TOKEN belongs to), you'll also need to make sure to hit the /connect endpoint to make sure the bot account is added as a collaborator on your main account. Also, the /v2 endpoints don't need a service name so you can delete 'github' from your URL.

You may find this link helpful if you haven't already seen it.

All 77 comments

@IgorKowalczyk support has been dropped for the public instance. Please refer to the README for instructions on how to easily deploy your own instance to the free tier of heroku. Self hosting should provide you a much more reliable experience and the free tier of heroku is more than sufficient. I will be closing this issue but please feel free to post any further questions you may have here.

I tried to put it on the Heroku, but unfortunately, no guidebook worked for me...

I'm happy to assist you if you can tell me more about what went wrong when deploying your own to Heroku. Unfortunately it is not feasible for us to run a reliable public instance off of this community run project.

Let me explain. I've been doing everything as it's been handed down here: https://vincenttam.gitlab.io/post/2018-09-16-staticman-powered-gitlab-pages/2/ and here: https://muffinman.io/running-staticman-on-heroku/ unfortunately I didn't get to the correction in the second article because I had problems in the first one.
The command heroku config:set RSA_PRIVATE_KEY="$(cat key.pem)" did not work. My program was showing only an error: Program: does not exist. This may be related to $ openssl genrsa -out key.pem or to the "Stage 2: project config" section. I don't know what could be an error - maybe I misread the manual (I use the translator).

Sorry about my English too. (Translator - not google of course :smile:)

I would recommend consulting the README of this repo which has some more updated instructions. There is a "Deploy to Heroku" button in the README which simplifies much of the steps indicated in those links you provided. The discussion at the end of this issue may provide some additional clarity.

Thank you, but I have a problem with the configuration file...

From: config.sample.json

{
  "gitlabToken." "YOUR_GITLAB_TOKEN."
  "githubToken." "YOUR_GITHUB_TOKEN."
  "rsaPrivateKey." "-----BEGIN RSA PRIVATE KEY---YOUR_KEY---END RSA PRIVATE KEY--"
  "port." 80
}

With the RSA key copied straight from the Github, change the text "YOUR_KEY" or something else, and remove the gitlabToken line or leave it as it is? Because I haven't seen it anywhere.

If you are hosting on GitHub pages, then use the "githubToken" key and remove the "gitlabToken" key. If you are hosting on GitLab pages, then use the "gitlabToken" key and remove the "githubToken" key.

The text for the "rsaPrivateKey" value should be changed to the text of your own private RSA key as a single-line string with \n newline characters.

The text for the "rsaPrivateKey" value should be changed to the text of your own private RSA key as a single-line string with \n newline characters.

I don't understand it...

Have you created a public/private RSA key pair? If not, follow the steps outlined here to create one. Once you have a key pair generated, it'll likely be stored in ~/.ssh/id_rsa. This is your private RSA key. You can print it to your console with cat ~/.ssh/id_rsa. This will show your private key in the form:

-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUp
wmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5
1s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQABAoGAFijko56+qGyN8M0RVyaRAXz++xTqHBLh
3tx4VgMtrQ+WEgCjhoTwo23KMBAuJGSYnRmoBZM3lMfTKevIkAidPExvYCdm5dYq3XToLkkLv5L2
pIIVOFMDG+KESnAFV7l2c+cnzRMW0+b6f8mR1CJzZuxVLL6Q02fvLi55/mbSYxECQQDeAw6fiIQX
GukBI4eMZZt4nscy2o12KyYner3VpoeE+Np2q+Z3pvAMd/aNzQ/W9WaI+NRfcxUJrmfPwIGm63il
AkEAxCL5HQb2bQr4ByorcMWm/hEP2MZzROV73yF41hPsRC9m66KrheO9HPTJuo3/9s5p+sqGxOlF
L0NDt4SkosjgGwJAFklyR1uZ/wPJjj611cdBcztlPdqoxssQGnh85BzCj/u3WqBpE2vjvyyvyI5k
X6zk7S0ljKtt2jny2+00VsBerQJBAJGC1Mg5Oydo5NwD6BiROrPxGo2bpTbu/fhrT8ebHkTz2epl
U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0=
-----END RSA PRIVATE KEY-----

As you can see, here we have a multiline, key string. However, the configuration value must all be on one line. You must make this a single line string with explicit \n newline characters. You can convert this by hand, or with the following command: cat ~/.ssh/id_rsa | sed '$!s/$/\\n/' | tr -d '\n'.

The output, which you will paste into your config file, should appear something like:

-----BEGIN RSA PRIVATE KEY-----\nMIICXAIBAAKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUp\nwmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5\n1s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQABAoGAFijko56+qGyN8M0RVyaRAXz++xTqHBLh\n3tx4VgMtrQ+WEgCjhoTwo23KMBAuJGSYnRmoBZM3lMfTKevIkAidPExvYCdm5dYq3XToLkkLv5L2\npIIVOFMDG+KESnAFV7l2c+cnzRMW0+b6f8mR1CJzZuxVLL6Q02fvLi55/mbSYxECQQDeAw6fiIQX\nGukBI4eMZZt4nscy2o12KyYner3VpoeE+Np2q+Z3pvAMd/aNzQ/W9WaI+NRfcxUJrmfPwIGm63il\nAkEAxCL5HQb2bQr4ByorcMWm/hEP2MZzROV73yF41hPsRC9m66KrheO9HPTJuo3/9s5p+sqGxOlF\nL0NDt4SkosjgGwJAFklyR1uZ/wPJjj611cdBcztlPdqoxssQGnh85BzCj/u3WqBpE2vjvyyvyI5k\nX6zk7S0ljKtt2jny2+00VsBerQJBAJGC1Mg5Oydo5NwD6BiROrPxGo2bpTbu/fhrT8ebHkTz2epl\nU9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ\n37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0=\n-----END RSA PRIVATE KEY-----

EDIT: The above instructions are incorrect. Please see the proper way to generate a key further down this thread

When I type the command heroku config:set RSA_PRIVATE_KEY="$(cat ./key.pem)" (I generated the key earlier) I get a message 'C:\Program' is not recognized as an internal or external command, operable program or batch file.
I don't know why this is happening.

I use the guide: https://yasoob.me/posts/running_staticman_on_static_hugo_blog_with_nested_comments/# (Readme does not help me much)

Try using the heroku web interface rather than the command line. See instructions at this link under the section "Managing config vars" and the subsection "Using the Heroku Dashboard".

Thank you. I just don't know how to change files like Profile. If I can write in a few minutes

I'm sorry, I don't know what you are referring to. I'm not aware of any Profile file, nor should you need to make any file changes to deploy a Heroku instance. All you should have to do is click the deploy button from the README and then configure your config vars as described above. After that, you will still have to configure your website to call your Heroku instance.

The Procfile should contain a line: web: npm start, Heroku probably does something with this file.

Now create another file with the name of Procfile in the root of this cloned repo and add this to it:
web: npm start

You do not need that file. That guide you are following is outdated and the "Deploy to Heroku" button does much of that for you. Again, all you should need to do is click that deploy button from our README and then add your config variables.

I did as in the guide in readme - I entered the first command (on the Herok website) git clone [email protected]:IgorKowalczykBot/staticman.git (My fork for the repository - current) and the console shows such an error as in the picture.

img

EDIT:
If I copy the original repository (git clone [email protected]:eduardoboucas/staticman.git) the situation is the same.

That section of the README is referring to running the server on your own infrastructure. Those steps are not necessary when using Heroku. Again, the only steps you need to follow to deploy to heroku are clicking the deploy button and entering your config variables.

But I still don't know how to enter the configuration variables. Maybe it's a Heroku section, like in the picture.

img

Once you have clicked the "Deploy to Heroku" button, you will be redirected to the Heroku page. Here you will give your instance a name and click deploy. Once this has finished, click the "Manage App" button at the bottom of the screen. At the top there will be a tab called "Settings" which you will click. On the settings page, click "Reveal Config Vars" and add the configuration values for your instance.

I did as you said. I added those values. I don't know if you need to add NODE_ENV yet. When I open my application it shows an error: https://api-igorkowalczyk.herokuapp.com/

img

You can check your logs to try to see what exactly went wrong. I believe you must set a value for the port config value as well. I don't believe a NODE_ENV is necessary. Without access to the logs it is hard for me to tell exactly what is wrong with your setup.

2020-02-23T19:20:25.598063+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=api-igorkowalczyk.herokuapp.com request_id=78c9703b-434e-4863-ba78-497480ee36f4 fwd="77.111.245.53" dyno= connect= service= status=503 bytes= protocol=https
2020-02-23T19:20:27.256751+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=api-igorkowalczyk.herokuapp.com request_id=4658d9b4-9ae2-4d65-b645-82c6267ecd59 fwd="77.111.245.53" dyno= connect= service= status=503 bytes= protocol=https
2020-02-23T19:22:33.542508+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=api-igorkowalczyk.herokuapp.com request_id=fbe1a40a-5f29-42aa-948f-01c645938cd9 fwd="65.24.251.107" dyno= connect= service= status=503 bytes= protocol=https
2020-02-23T19:22:33.743342+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=api-igorkowalczyk.herokuapp.com request_id=a564d5ec-1373-475d-9c25-bbd9614da488 fwd="65.24.251.107" dyno= connect= service= status=503 bytes= protocol=https
2020-02-23T19:22:53.201986+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=api-igorkowalczyk.herokuapp.com request_id=b5b345ba-dcd9-49aa-a082-3ce39431130f fwd="65.24.251.107" dyno= connect= service= status=503 bytes= protocol=https
2020-02-23T19:22:53.282046+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=api-igorkowalczyk.herokuapp.com request_id=f90c10c8-d5db-4c5e-b47a-6a790f1e6c7c fwd="65.24.251.107" dyno= connect= service= status=503 bytes= protocol=https
2020-02-23T19:22:58.118016+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=api-igorkowalczyk.herokuapp.com request_id=fb2ca08f-c24d-42fe-9f0b-514353a41333 fwd="65.24.251.107" dyno= connect= service= status=503 bytes= protocol=https
2020-02-23T19:22:58.236792+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=api-igorkowalczyk.herokuapp.com request_id=62319441-afb9-4750-8aee-0f2f488ed82c fwd="65.24.251.107" dyno= connect= service= status=503 bytes= protocol=https
2020-02-23T19:23:55.565173+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=api-igorkowalczyk.herokuapp.com request_id=c9abdf9a-1fa2-4394-87d4-e8916b330c38 fwd="65.24.251.107" dyno= connect= service= status=503 bytes= protocol=https
2020-02-23T19:23:55.711107+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=api-igorkowalczyk.herokuapp.com request_id=d1dabfe1-7f1d-44b6-9548-bd79d9561aa5 fwd="65.24.251.107" dyno= connect= service= status=503 bytes= protocol=https

The logs don't tell anything. I copied everything that showed up there.

Hmm I went to try to deploy the entire thing myself and am encountering similar issues with the RSA key. I will reopen this issue and investigate when I have time.

I tried the pull request version but it still doesn't work. Heroku shows only the logs as in the picture.

img

@IgorKowalczyk apologies, I believe my previous instructions for generating an RSA key were incorrect. The RSA_PRIVATE_KEY value you provide to Heroku should not have any \n newline characters. The key should however still all be on one line.

To summarize:

  • Create RSA key with ssh-keygen -t rsa -b 4096 -C "staticman key" -f ~/.ssh/staticman_key
  • Convert the string to be on one line with cat ~/.ssh/staticman_key | tr -d '\n'

Your key as entered into Heroku should look something like this:

-----BEGIN RSA PRIVATE KEY-----MIICXAIBAAKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUpwmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ51s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQABAoGAFijko56+qGyN8M0RVyaRAXz++xTqHBLh3tx4VgMtrQ+WEgCjhoTwo23KMBAuJGSYnRmoBZM3lMfTKevIkAidPExvYCdm5dYq3XToLkkLv5L2pIIVOFMDG+KESnAFV7l2c+cnzRMW0+b6f8mR1CJzZuxVLL6Q02fvLi55/mbSYxECQQDeAw6fiIQXGukBI4eMZZt4nscy2o12KyYner3VpoeE+Np2q+Z3pvAMd/aNzQ/W9WaI+NRfcxUJrmfPwIGm63ilAkEAxCL5HQb2bQr4ByorcMWm/hEP2MZzROV73yF41hPsRC9m66KrheO9HPTJuo3/9s5p+sqGxOlFL0NDt4SkosjgGwJAFklyR1uZ/wPJjj611cdBcztlPdqoxssQGnh85BzCj/u3WqBpE2vjvyyvyI5kX6zk7S0ljKtt2jny2+00VsBerQJBAJGC1Mg5Oydo5NwD6BiROrPxGo2bpTbu/fhrT8ebHkTz2eplU9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0=-----END RSA PRIVATE KEY-----

I generated a new key (correct) application still does not work. I don't know what to do next.

I can't tell what your error is without some kind of error message or logs. The fix should be merged into dev, but is not yet in master. When clicking the deploy button, ensure you are looking at the README on the dev branch. You also may want to try manually restarting your Heroku infrastructure by going to "More" in the top right corner of the dashboard and selecting "Restart all dynos".

In my project (fork staticman) I gave dev's master commit to the branch. Still doesn't work. Logs still the same.

You do not appear to have a fork of staticman on your GitHub. Are you referring to a local copy? I have tested the instructions I have provided to you multiple times and I am able to successfully deploy instances without issue. Rather than trying to use your own fork, use the button in the top left of this repo's main page to select the dev branch. Once that page loads, use the "Deploy to Heroku" button there to deploy this dev branch. When you are redirected to Heroku, you should see that the repo it is deploying from contains #dev.

The errors you are seeing indicate that there is a problem with your RSA key. Ensure you have generated it using the provided command, and that all newline characters have been removed so that the text is all on one line. The minimal config values needed by this application are GITHUB_TOKEN and RSA_PRIVATE_KEY. Try without any other config values.

My fork is https://github.com/igorkowalczykbot/staticman, because I want to use this account for comments. I'll try today when I have time from the original repository.

I tried the dev branch and it still doesn't work, I filled in the correct github token (repo access), and correctly generated RSA PRIVATE KEY. The application still returns an error.
Here are the logs.

2020-02-25T20:22:03.630277+00:00 heroku[web.1]: State changed from starting to crashed
2020-02-25T20:22:03.611270+00:00 heroku[web.1]: Process exited with status 0
2020-02-25T20:22:11.720865+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=api-igorkowalczyk.herokuapp.com request_id=ce663a5d-d2ac-40df-8732-360c78ea5cef fwd="77.111.245.66" dyno= connect= service= status=503 bytes= protocol=https
2020-02-25T20:22:19.808818+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=api-igorkowalczyk.herokuapp.com request_id=41561a29-2a91-4fd0-9f77-9909fe8d8585 fwd="77.111.245.66" dyno= connect= service= status=503 bytes= protocol=https

I've read the logs to the bug 503

That part of the logs doesn't indicate what caused the crash. Try leaving the logs console open in one tab and restarting all dynos in another so you can view the full logs. That should hopefully give us a more verbose error message.

2020-02-26T01:44:27.460725+00:00 app[web.1]:     at NodeRSA.module.exports.NodeRSA.importKey (/app/node_modules/node-rsa/src/NodeRSA.js:185:22)
2020-02-26T01:44:27.460725+00:00 app[web.1]:     at Object.<anonymous> (/app/lib/RSA.js:6:5)
2020-02-26T01:44:27.460726+00:00 app[web.1]:     at Module._compile (internal/modules/cjs/loader.js:1151:30)
2020-02-26T01:44:27.460726+00:00 app[web.1]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
2020-02-26T01:44:27.460727+00:00 app[web.1]:     at Module.load (internal/modules/cjs/loader.js:1000:32) {
2020-02-26T01:44:27.460727+00:00 app[web.1]:   name: 'InvalidAsn1Error',
2020-02-26T01:44:27.460727+00:00 app[web.1]:   message: 'encoding too long'
2020-02-26T01:44:27.460728+00:00 app[web.1]: }
2020-02-26T01:44:27.531480+00:00 heroku[web.1]: State changed from starting to crashed
2020-02-26T01:44:27.516295+00:00 heroku[web.1]: Process exited with status 0
2020-02-26T06:37:53.524000+00:00 heroku[web.1]: State changed from crashed to starting
2020-02-26T06:37:57.576014+00:00 heroku[web.1]: Starting process with command `npm start`
2020-02-26T06:37:59.481212+00:00 app[web.1]: 
2020-02-26T06:37:59.481231+00:00 app[web.1]: > [email protected] prestart /app
2020-02-26T06:37:59.481232+00:00 app[web.1]: > if [ ! -d node_modules ]; then npm install; fi
2020-02-26T06:37:59.481232+00:00 app[web.1]: 
2020-02-26T06:37:59.492289+00:00 app[web.1]: 
2020-02-26T06:37:59.492291+00:00 app[web.1]: > [email protected] start /app
2020-02-26T06:37:59.492291+00:00 app[web.1]: > node index.js
2020-02-26T06:37:59.492291+00:00 app[web.1]: 
2020-02-26T06:37:59.893738+00:00 app[web.1]: Error [InvalidAsn1Error]: encoding too long
2020-02-26T06:37:59.893802+00:00 app[web.1]:     at newInvalidAsn1Error (/app/node_modules/node-rsa/node_modules/asn1/lib/ber/errors.js:7:13)
2020-02-26T06:37:59.893803+00:00 app[web.1]:     at Reader.readLength (/app/node_modules/node-rsa/node_modules/asn1/lib/ber/reader.js:102:13)
2020-02-26T06:37:59.893803+00:00 app[web.1]:     at Reader.readSequence (/app/node_modules/node-rsa/node_modules/asn1/lib/ber/reader.js:135:16)
2020-02-26T06:37:59.893804+00:00 app[web.1]:     at Object.privateImport (/app/node_modules/node-rsa/src/formats/pkcs1.js:63:16)
2020-02-26T06:37:59.893804+00:00 app[web.1]:     at Object.detectAndImport (/app/node_modules/node-rsa/src/formats/formats.js:63:48)
2020-02-26T06:37:59.893805+00:00 app[web.1]:     at NodeRSA.module.exports.NodeRSA.importKey (/app/node_modules/node-rsa/src/NodeRSA.js:185:22)
2020-02-26T06:37:59.893805+00:00 app[web.1]:     at Object.<anonymous> (/app/lib/RSA.js:6:5)
2020-02-26T06:37:59.893806+00:00 app[web.1]:     at Module._compile (internal/modules/cjs/loader.js:1151:30)
2020-02-26T06:37:59.893806+00:00 app[web.1]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
2020-02-26T06:37:59.893806+00:00 app[web.1]:     at Module.load (internal/modules/cjs/loader.js:1000:32) {
2020-02-26T06:37:59.893807+00:00 app[web.1]:   name: 'InvalidAsn1Error',
2020-02-26T06:37:59.893807+00:00 app[web.1]:   message: 'encoding too long'
2020-02-26T06:37:59.893808+00:00 app[web.1]: }
2020-02-26T06:37:59.968328+00:00 heroku[web.1]: State changed from starting to crashed
2020-02-26T06:37:59.972446+00:00 heroku[web.1]: State changed from crashed to starting
2020-02-26T06:37:59.950476+00:00 heroku[web.1]: Process exited with status 0
2020-02-26T06:38:03.842371+00:00 heroku[web.1]: Starting process with command `npm start`
2020-02-26T06:38:05.909035+00:00 app[web.1]: 
2020-02-26T06:38:05.909056+00:00 app[web.1]: > [email protected] prestart /app
2020-02-26T06:38:05.909057+00:00 app[web.1]: > if [ ! -d node_modules ]; then npm install; fi
2020-02-26T06:38:05.909057+00:00 app[web.1]: 
2020-02-26T06:38:05.919382+00:00 app[web.1]: 
2020-02-26T06:38:05.919384+00:00 app[web.1]: > [email protected] start /app
2020-02-26T06:38:05.919384+00:00 app[web.1]: > node index.js
2020-02-26T06:38:05.919384+00:00 app[web.1]: 
2020-02-26T06:38:06.329557+00:00 app[web.1]: Error [InvalidAsn1Error]: encoding too long
2020-02-26T06:38:06.337943+00:00 app[web.1]:     at newInvalidAsn1Error (/app/node_modules/node-rsa/node_modules/asn1/lib/ber/errors.js:7:13)
2020-02-26T06:38:06.337946+00:00 app[web.1]:     at Reader.readLength (/app/node_modules/node-rsa/node_modules/asn1/lib/ber/reader.js:102:13)
2020-02-26T06:38:06.337946+00:00 app[web.1]:     at Reader.readSequence (/app/node_modules/node-rsa/node_modules/asn1/lib/ber/reader.js:135:16)
2020-02-26T06:38:06.337947+00:00 app[web.1]:     at Object.privateImport (/app/node_modules/node-rsa/src/formats/pkcs1.js:63:16)
2020-02-26T06:38:06.337948+00:00 app[web.1]:     at Object.detectAndImport (/app/node_modules/node-rsa/src/formats/formats.js:63:48)
2020-02-26T06:38:06.337948+00:00 app[web.1]:     at NodeRSA.module.exports.NodeRSA.importKey (/app/node_modules/node-rsa/src/NodeRSA.js:185:22)
2020-02-26T06:38:06.337949+00:00 app[web.1]:     at Object.<anonymous> (/app/lib/RSA.js:6:5)
2020-02-26T06:38:06.337950+00:00 app[web.1]:     at Module._compile (internal/modules/cjs/loader.js:1151:30)
2020-02-26T06:38:06.337950+00:00 app[web.1]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
2020-02-26T06:38:06.337951+00:00 app[web.1]:     at Module.load (internal/modules/cjs/loader.js:1000:32) {
2020-02-26T06:38:06.337952+00:00 app[web.1]:   name: 'InvalidAsn1Error',
2020-02-26T06:38:06.337952+00:00 app[web.1]:   message: 'encoding too long'
2020-02-26T06:38:06.337953+00:00 app[web.1]: }
2020-02-26T06:38:06.419069+00:00 heroku[web.1]: State changed from starting to crashed
2020-02-26T06:38:06.401866+00:00 heroku[web.1]: Process exited with status 0
2020-02-26T06:38:37.755263+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=api-igorkowalczyk.herokuapp.com request_id=32830188-8e1c-4997-a6ac-51544bcf9ed2 fwd="77.111.245.66" dyno= connect= service= status=503 bytes= protocol=https

All logs when restarting

Hmm, definitely still a problem with the RSA key. Can you try generating the key with:
openssl genrsa -out private.pem 2048
cat private.pem | tr -d '\n'

-----END RSA PRIVATE KEY-----z84uLNRXvnMPhnJ73jZbXFoAlkDu3PVgjmQ This is the key when i generate with second command (i paste first too)

That's not right. The key should appear in your terminal something like:

-----BEGIN RSA PRIVATE KEY-----MIIEowIBAAKCAQEAtvUg5B1ozIO6FHCiO2RXBUOBDVqISFKMSUXM4gZYkN1nrquL0Ii/WImuoPMmnaOKwIIpjXJy5+Zv7LD0sVCGoGzBszWsB3JureJXJbAsOhLSwQ0Gy5nuuYcPy+spZarf+HEyuDIRSgIPwMeWlYBQfQOBIvc4F2UPyYuavLQ/GI7n251USwdYd+kyM0Q/9JFubaadh8n93hOV5AVyIroPgykNM+HyZZzR/F6ss59XDC/R8DQCYNHBiyGwQw9U8ZXbTchQDqyOXWu54ofGWAU3vbdHnlbEu8vgS11H/eb9yr68SZW4u+P3zN5IIuYnCCnBltWW+IBAHUXy4kifdXkFIQIDAQABAoIBABLD/cWoBpHDiRiDnQA+gHZ3wArgmE3iuaTiVetw/zCMpQ/TZJnVDNtF8/VqOzG8DoVEVIK/lG2Ywy4h0FdHjSdzQELjZGu3HwcSyiGBemfSem92qJXFiijZY5Nk4XAeIK7Y3XzrFb7jiz4YuqdG6/qGm348oTI1GXNwsEResIISKeNngk0bF1JB2Wx1mYW3+aBe/oMe40oLjcfNYVi5wotdTQVODm10YecX4iPPcp5YeQxPC4CCWZH8KbnVHNmyVPC0PGJtzNDIXwTwy1oDM1PugXtT5Ux8ntfw0mUoVOM9cuogo9cO5brQR75YNLRQpGX7yWkkr5e3baURVd943mECgYEA4UYvlQCXKzksuGlK8CwE8nK5nIVwT7AuP8/havdJHmn27WZRZDs6Qz0UbWfX8b8vqm4Vu4UBKf+YqsC6odMc9r0U0zv3O4FQkTgrwAoDIjkTd9/ytSugpWl6IUDD+PNFLMb+pbxVArHCE5opdzZf4POSd2W/gtbY/qkKfT5yMZUCgYEAz+ljec1kz7xeWC/scKM+5O0dpDt/v6mPbPQbJhb8bs8Dpa7T+VowAbRUe6HwvQ3Q4JD3qrtL+xVovMTenRNiBKspqJgg00GrMyBtOjhufveo3GTXWuDo6dGGIzxisYfKXmXkT0ItW0IIE2CZOpPQGJjldcKBpPZVmEUp6dHsel0CgYBvNXfN5fG6m8oQ66Hb+M8kZTBuLY2pOT9LrzMH3DXTdto4jhdGFNsJUIDiFa6MICbGyvudi+ZsNkrGmMhJlO+qeuNp+CNv08HTPtiSQB8V6PlMZ1joyTXQEscA3XkhT+7pUP9rEBMjdl9pz+QCfuxMH9JBcRBe5fNPnGGaPJahFQKBgAfOrtKbGOcIHs7W9d0A9FKqaMuLBHAREPa5b++NO2t50Jw/JWyeq2DVAbsmyKCAzVAxgWti3yaNlkJIbkedu7eLKeRP2iO0upYP6KogBl40NJ4aF1AtU/G70XqvQNGD1OCYmOs1A/kCUMVRgk+Fz3GtBCjY5f9o1KwEJN/H50ZtAoGBALdgtwSQNfUGBGVhSsf8wmiDrlN6NdjSXyfYHzbnpRot/LKokF8x2/imMmAWIUxYLAg6TxapWNS+Xm+ut2WqXEs51TGTCkQxOLyIMRgj+lSZDFHy0cAPbmI8bva5+ACVKbtmM3Rk8I+GQ3K5uWXXdZ/00BvKA/b+qOxUmTlFrqsy-----END RSA PRIVATE KEY-----

Which is the string you would enter into the Heroku config variable. You should not have more characters after the end of -----END RSA PRIVATE KEY-----

In Heroku that should look like:

-----BEGIN RSA PRIVATE KEY-----MIIEowIBAAKCAQEAtvUg5B1ozIO6FHCiO2RXBUOBDVqISFKMSUXM4gZYkN1nrquL0Ii/WImuoPMmnaOKwIIpjXJy5+Zv7LD0sVCGoGzBszWsB3JureJXJbAsOhLSwQ0Gy5nuuYcPy+spZarf+HEyuDIRSgIPwMeWlYBQfQOBIvc4F2UPyYuavLQ/GI7n251USwdYd+kyM0Q/9JFubaadh8n93hOV5AVyIroPgykNM+HyZZzR/F6ss59XDC/R8DQCYNHBiyGwQw9U8ZXbTchQDqyOXWu54ofGWAU3vbdHnlbEu8vgS11H/eb9yr68SZW4u+P3zN5IIuYnCCnBltWW+IBAHUXy4kifdXkFIQIDAQABAoIBABLD/cWoBpHDiRiDnQA+gHZ3wArgmE3iuaTiVetw/zCMpQ/TZJnVDNtF8/VqOzG8DoVEVIK/lG2Ywy4h0FdHjSdzQELjZGu3HwcSyiGBemfSem92qJXFiijZY5Nk4XAeIK7Y3XzrFb7jiz4YuqdG6/qGm348oTI1GXNwsEResIISKeNngk0bF1JB2Wx1mYW3+aBe/oMe40oLjcfNYVi5wotdTQVODm10YecX4iPPcp5YeQxPC4CCWZH8KbnVHNmyVPC0PGJtzNDIXwTwy1oDM1PugXtT5Ux8ntfw0mUoVOM9cuogo9cO5brQR75YNLRQpGX7yWkkr5e3baURVd943mECgYEA4UYvlQCXKzksuGlK8CwE8nK5nIVwT7AuP8/havdJHmn27WZRZDs6Qz0UbWfX8b8vqm4Vu4UBKf+YqsC6odMc9r0U0zv3O4FQkTgrwAoDIjkTd9/ytSugpWl6IUDD+PNFLMb+pbxVArHCE5opdzZf4POSd2W/gtbY/qkKfT5yMZUCgYEAz+ljec1kz7xeWC/scKM+5O0dpDt/v6mPbPQbJhb8bs8Dpa7T+VowAbRUe6HwvQ3Q4JD3qrtL+xVovMTenRNiBKspqJgg00GrMyBtOjhufveo3GTXWuDo6dGGIzxisYfKXmXkT0ItW0IIE2CZOpPQGJjldcKBpPZVmEUp6dHsel0CgYBvNXfN5fG6m8oQ66Hb+M8kZTBuLY2pOT9LrzMH3DXTdto4jhdGFNsJUIDiFa6MICbGyvudi+ZsNkrGmMhJlO+qeuNp+CNv08HTPtiSQB8V6PlMZ1joyTXQEscA3XkhT+7pUP9rEBMjdl9pz+QCfuxMH9JBcRBe5fNPnGGaPJahFQKBgAfOrtKbGOcIHs7W9d0A9FKqaMuLBHAREPa5b++NO2t50Jw/JWyeq2DVAbsmyKCAzVAxgWti3yaNlkJIbkedu7eLKeRP2iO0upYP6KogBl40NJ4aF1AtU/G70XqvQNGD1OCYmOs1A/kCUMVRgk+Fz3GtBCjY5f9o1KwEJN/H50ZtAoGBALdgtwSQNfUGBGVhSsf8wmiDrlN6NdjSXyfYHzbnpRot/LKokF8x2/imMmAWIUxYLAg6TxapWNS+Xm+ut2WqXEs51TGTCkQxOLyIMRgj+lSZDFHy0cAPbmI8bva5+ACVKbtmM3Rk8I+GQ3K5uWXXdZ/00BvKA/b+qOxUmTlFrqsy-----END RSA PRIVATE KEY-----

Note there are no spaces or \n characters.

Thanks to Travis, I was able to get my key accepted at Heroku. The important new feature was the "-m PEM" option on ssh-keygen.

ssh-keygen -m PEM -t rsa -b 4096 -C "staticman key" -f ~/.ssh/staticman_key
heroku config:add --app ${bridge_app_name} "RSA_PRIVATE_KEY=$(cat ~/.ssh/staticman_key | tr -d '\n')"
heroku config:add --app ${bridge_app_name} "GITHUB_TOKEN=${github_token}"

@willymcallister When i paste the second comment my output is:

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

@alexwaibel I paste these commends in the Git Bash terminal maybe it's his fault.

@IgorKowalczyk -- If commands starting with 'heroku' are not recognized in your terminal window that probably means you don't have the Heroku Command Line Interface installed. Check out this document, https://travisdowns.github.io/blog/2020/02/05/now-with-comments.html#configure-bridge-secrets, and "Follow _the instructions_ to install and login to the Heroku CLI,". The link takes you to https://devcenter.heroku.com/articles/heroku-cli.

When this is working right you will be able to use heroku commands in a regular terminal window on your computer to set configuration values using the commands above, plus things like...
heroku config --app ${your_bridge_app_name}
and
heroku logs --app ${your_bridge_app_name}

@IgorKowalczyk I do not believe Git Bash will work for most of these commands. From what I understand, Git Bash does not include many of the default unix commands. If you are using Windows 10, I recommend giving the Windows Subsystem for Linux a try.

EDIT: Alternatively you could try using PuttyGen to generate your RSA key.

@willymcallister I'm already have Heroku CLI installed.


@alexwaibel If i have time i will try this solution.

@alexwaibel I generated a new key with Putty - it looks like a regular key from the Git Bash console (only with spaces and new lines). Maybe I'll describe all the steps I do - maybe I'm doing something wrong.

  1. I go to the dev branch on the original project and click on the readme button "Deploy to Heroku"

  2. when I'm transferred to herok, I give the application the name "api-igorificator" (it is available),
    I set the region to the USA and wait for the application to be created.

  3. I click the manage app and go to "Config Vars" settings. In the first field I enter GITHUB_TOKEN and copy the account access token generated by github and paste it there. In the second field, I enter RSA_PRIVATE_KEY and paste the token generated by the console. I save this section and check if application works.

@alexwaibel Thanks so much for your kind patience with @IgorKowalczyk. Your instructions are really helpful

My Heroku app URL: https://anasbasem.herokuapp.com It works well (Hello from Staticman version 3.0.0!)
Here is my Minimal Staticman v3 Demo URL: https://basemwahba.github.io/anas
This is my Github repository: https://github.com/basemwahba/anas

Below is the screenshot from Heroku app log:

Screen Shot 2020-03-03 at 9 19 14 PM

I appreciate your kind help

Thanks so much

@alexwaibel May you please have a quick look at the error in my Heroku app log screenshot in my previous post?

Here it's:

2020-03-04T00:53:48.472979+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/v3/entry/github/basemwahba/anas/master/comments" host=anasbasem.herokuapp.com request_id=8a24e204-a016-461e-8503-850798dea306 fwd="41.46.157.92" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https

It shows the following error:

Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail

Screen Shot 2020-03-04 at 2 51 40 AM

May you please advise from where can I fix?

Thanks so much

@basemwahba do you have a GitHub personal access token in your Heroku config vars? Based on the screenshot from your first post, it seems to be having issues authenticating with GitHub.

@alexwaibel Thanks for your time and your response

Yes I have GitHub personal access token

Screen Shot 2020-03-04 at 3 59 35 AM

Screen Shot 2020-03-04 at 4 04 11 AM

@basemwahba Can you try using this call instead:
method=POST path="/v2/entry/basemwahba/anas/master"

v3 supports only GitHub application authentication from what I can tell

@alexwaibel Thanks again

I get different message:
{"success":false,"errorCode":"INVALID_VERSION"}

Screen Shot 2020-03-04 at 4 49 02 AM

Below is Heroku app log:

Screen Shot 2020-03-04 at 4 47 07 AM

@IgorKowalczyk to be clear, when using puttygen you must:

  1. Click 'Generate' ensuring 'RSA' is the type selected and number of bits is 2048
  2. Move your mouse around
  3. Click 'Conversions' in the top menu, and then 'Export OpenSSH key'
  4. Accept the warning about no passphrase, this is expected.
  5. Save the key somewhere you'll remember.
  6. Open Powershell
  7. Use (Get-Content 'C:\username\Downloads\keyfile') -join '' | Set-Content 'C:\username\Downloads\keyfile' ensuring you replace the path with your key path.
  8. Use Get-Content 'C:\username\Downloads\keyfile' to print your key to the console. Copy this key, being careful to avoid copying any trailing spaces and also again making sure to replace the path with your actual path.
  9. Paste that value into Heroku

I've just used this exact method to deploy the dev branch and it worked.

@basemwahba You shouldn't be calling a GET request to that endpoint. The /entry endpoints are for posting comment forms to. If you are using a separate bot account (the account your GITHUB_TOKEN belongs to), you'll also need to make sure to hit the /connect endpoint to make sure the bot account is added as a collaborator on your main account. Also, the /v2 endpoints don't need a service name so you can delete 'github' from your URL.

You may find this link helpful if you haven't already seen it.

@alexwaibel

Also, the /v2 endpoints don't need a service name so you can delete 'github' from your URL.

This worked. I have changed to V2. Then, in the endpoint URL path, I have removed github that is between entry and before basemwahba Thank you. Thank you very much 🙂

Finally, do you have any suggestion to make V3 works?

For /v3 with github, you must authenticate as a GitHub app.

  1. Go to your GitHub Settings then Developer settings on the account hosting your website.
  2. Select the 'GitHub Apps' tab and click 'New GitHub App'.\
  3. Name the app, give it a Homepage URL, and give it full Read & Write Pull request access
  4. In Heroku, use the GITHUB_APP_ID instead of GITHUB_TOKEN and paste in the App ID from GitHub.
  5. Click 'Generate a private key' at the bottom of the GitHub app page
  6. Convert that downloaded key to be all on one line and add it to the Heroku config vars as GITHUB_PRIVATE_KEY
  7. You also probably have to click the 'Install App' tab in GitHub and install the app to your account.

Going a bit off memory but that should work.

@alexwaibel
Thanks again for your usual cooperation. I will follow your instructions exactly and I'm confident that it will work. At the end, will I create something like this: https://github.com/apps/staticman-net/?

@basemwahba yes, although your application doesn't have to be public. It can be created for just your account when you fill out the form to create a new GitHub application.

Yeah. The key needs spaces (new lines) I didn't have them. After generating the key with PuTTy and copying it with N++ and pasting it into RSA_PRIVATE_KEY the application worked: https://api-igorkowalczyk.herokuapp.com/.
Shows "Hello from Staticman version 3.0.0! But when I go to the site: https://api-igorkowalczyk.herokuapp.com/v2/entry/igorkowalczyk/blog/master shows: ``Cannot GET /v2/entry/igorkowalczyk/blog/master
I remember "Invite the bot", but when I go to the site: https://api-igorkowalczyk.herokuapp.com/v2/connect/igorkowalczyk/blog, I get a sign: Invitation not found but I already invited my bot as shown in the screenshot below

img

PS: I want to use v2 API, however, seems better to me and it works the same (I guess), no need to add (and create new) applications.

@IgorKowalczyk in your connect call, the username should be that of your bot account not your main account. The connect endpoint is meant to make your bot account accept the collaborator invite.

@IgorKowalczyk I was wrong, it should be your normal account name and not the bot account.

The correct form is a GET request to

https://api-igorkowalczyk.herokuapp.com/v2/connect/igorkowalczyk/blog

You can try revoking and resending the invitation. Watch the Heroku logs too to see if anything errors are being thrown there. Worst case, you can log in to the bot account and manually accept the invite.

xhr.send(encodeURI(data)) I don't know why it sends requests to the site address and /null e.g. "https://igorkowalczyk.github.io/blog//internet/2020/01/22/null" and requests aren't sent, I don't know how to put it to send any to "https://api-igorkowalczyk.herokuapp.com/SEND COMMNETS"

Post when i try: https://igorkowalczyk.github.io/blog//internet/2020/01/22/Bezpieczeństwo-w-sieci-nasze-dane.html

@alexwaibel first of all, thank you for all your support here. I am running my own staticman instance on heroku as well, and trying to get it to work with my github pages blog. I was previously trying to use v3 using a personal access token. Thanks to you i now finally know that this won't work. So now I'm trying to switch to the GitHub App way as you described above. I have a couple of questions regarding that:

  • In my GitHub app setup, what do I put as Homepage URL and Webhook URL (both mandatory)?

  • In my staticman repo, in config.production.json, what variables do I need to set? Just githubAppID and githubPrivateKey or also still the rsaPrivateKey? And is the following the correct way of getting the variables from my env:

{
  "githubAppID": process.env.GITHUB_APP_ID,
  "githubPrivateKey": JSON.stringify(process.env.GITHUB_PRIVATE_KEY),
  "port": 8080
}

Any help on this would be really appreciated.

@IgorKowalczyk I'm not really sure what you're asking. That sounds like a problem with how you're submitting the comment form from your website.

@ElArkk Those URLs should be the URL of your staticman instance I believe. I don't think it really matters in this case though. As far as the config values, to run as a GitHub app you'll need rsaPrivateKey, githubAppID, and githubPrivateKey. Note these are two separate private keys.

I'm asking because my script can't send a request to api (and from that I don't know if this API works) The script below:

const commentForm = document.querySelector('.commentform');
const commentFormInputs = document.querySelectorAll('.commentform-input');
const slugInput = document.querySelector('.commentform-input-slug');
const optionsSlugInput = document.querySelector('.commentform-input-optionsslug');
const nameInput = document.querySelector('.commentform-input-name');
const emailInput = document.querySelector('.commentform-input-email');
const messageInput = document.querySelector('.commentform-input-message');
const errorMessagesDiv = document.querySelector('.commentform-errormessages');
const sendFailedDiv = document.querySelector('.commentform-sendfailed');
const sendSucceededDiv = document.querySelector('.commentform-sendsucceeded');
const url = 'https://api-igorkowalczyk.herokuapp.com/v2/entry/igorkowalczyk/blog/master';
function post(url, data, callback, errorCallback) {
const xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = function() {
if (xhr.status === 200) {
callback(xhr.responseText);
} else if (xhr.status !== 200) {
errorCallback(xhr.responseText);
}
};
xhr.send;
}
if (commentForm) {
commentForm.addEventListener('submit', (e) => {
e.preventDefault();
errorMessagesDiv.innerHTML = '';
sendFailedDiv.style.display = 'none';
sendSucceededDiv.style.display = 'none';
const slug = slugInput.value.trim();
const optionsSlug = optionsSlugInput.value.trim();
const name = nameInput.value.trim();
const email = emailInput.value.trim();
const message = messageInput.value.trim();
let error = false;
let fatalError = false;
const messages = [];
if (name.length < 2) {
error = true;
messages.push('<div class="commentform-errormessage">Proszę wpisać imię.</div>');
}
if (email.search(/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/) === -1) {
error = true;
messages.push('<div class="commentform-errormessage">Proszę wpisać poprawny e-mail.</div>');
}
if (message.length < 2) {
error = true;
messages.push('<div class="commentform-errormessage">Proszę wpisać wiadomość.</div>');
}
if (fatalError) {
return false;
}
if (error) {
errorMessagesDiv.innerHTML = messages.join('');
return false;
}
const params = [];
for (let i = 0; i < commentFormInputs.length; i++) {
const input = commentFormInputs[i];
params.push(`${ input.name }=${ input.value }`);
}
post(
console.log("Hello world!"),
e.target.getAttribute('data-action'),
params.join('&'),
function(text){
commentForm.reset();
sendSucceededDiv.style.display = 'block';
},
function(text){
sendFailedDiv.style.display = 'block';
}
);
});
}

And HTML (Rendered, Unrendered) here:
https://pastebin.com/a4Q9zsDN

@IgorKowalczyk you can try sending the request to the API directly with a REST client like Postman to see if the request is working as expected. From there try replicating that request in your front-end code. The postman request would look something like:

image

I'd first try to just use the bare HTML form for submissions and then once you've got that working you can start adding back in the javascript stuff.

@alexwaibel thank you! I'm still somehow getting MISSING_CONFIG_BLOCK errors, which I think can get thrown because of multiple underlying reasons. However, I got v2 to work finally, so I'll stick to that for now :). Thank you again!

@alexwaibel But I don't care if the API works anymore, the JS script sends out the requests badly, I don't know what to do... I reworked it a little bit to send requests from one API, but it still doesn't display any errors. Maybe it's the fault of this element:

post(
console.log("Hello world!"),
e.target.getAttribute('data-action'),
params.join('&'),
function(text){
commentForm.reset();
sendSucceededDiv.style.display = 'block';
},
function(text){
sendFailedDiv.style.display = 'block';
}
);
});
}

I added console.log there to check if the script works there.

@IgorKowalczyk well, this repo is strictly for fixing issues found in the Staticman API. I'm sorry, but I don't have the time to go through your project (and everyone else's that posts here) and figure out what's wrong with your front-end code.

As I suggested previously, I'd recommend going to bare HTML submission first to get the bare minimum comment submission functionality working and then you can start adding back in the javascript features you'd like to use. Additionally, the JS fetch API makes dealing with requests easier than using XMLHttpRequests in my opinion. You might find this Stack Overflow post to be helpful.

For /v3 with github, you must authenticate as a GitHub app.

  1. Go to your GitHub Settings then Developer settings on the account hosting your website.
  2. Select the 'GitHub Apps' tab and click 'New GitHub App'.\
  3. Name the app, give it a Homepage URL, and give it full Read & Write Pull request access
  4. In Heroku, use the GITHUB_APP_ID instead of GITHUB_TOKEN and paste in the App ID from GitHub.
  5. Click 'Generate a private key' at the bottom of the GitHub app page
  6. Convert that downloaded key to be all on one line and add it to the Heroku config vars as GITHUB_PRIVATE_KEY
  7. You also probably have to click the 'Install App' tab in GitHub and install the app to your account.

Going a bit off memory but that should work.

Hi @alexwaibel! I followed your instructions in this comment, but I'm getting a Request timeout. Here's the log trail:

2020-03-22T18:01:39.749062+00:00 app[web.1]: (node:24) UnhandledPromiseRejectionWarning: Error: error:0909006C:PEM routines:get_name:no start line
2020-03-22T18:01:39.749084+00:00 app[web.1]:     at Sign.sign (internal/crypto/sig.js:112:29)
2020-03-22T18:01:39.749084+00:00 app[web.1]:     at Object.sign (/app/node_modules/jwa/index.js:152:45)
2020-03-22T18:01:39.749085+00:00 app[web.1]:     at Object.jwsSign [as sign] (/app/node_modules/jws/lib/sign-stream.js:32:24)
2020-03-22T18:01:39.749085+00:00 app[web.1]:     at Object.module.exports [as sign] (/app/node_modules/jsonwebtoken/sign.js:204:16)
2020-03-22T18:01:39.749086+00:00 app[web.1]:     at getSignedJsonWebToken (/app/node_modules/@octokit/app/dist-node/index.js:31:30)
2020-03-22T18:01:39.749086+00:00 app[web.1]:     at GitHub._authenticate (/app/lib/GitHub.js:58:21)
2020-03-22T18:01:39.749086+00:00 app[web.1]:     at /app/lib/GitHub.js:31:32
2020-03-22T18:01:39.749088+00:00 app[web.1]:     at new GitHub (/app/lib/GitHub.js:46:7)
2020-03-22T18:01:39.749089+00:00 app[web.1]:     at Object.module.exports.create (/app/lib/GitServiceFactory.js:11:14)
2020-03-22T18:01:39.749089+00:00 app[web.1]:     at /app/lib/Staticman.js:32:35
2020-03-22T18:01:39.749089+00:00 app[web.1]:     at new Staticman (/app/lib/Staticman.js:46:7)
2020-03-22T18:01:39.749090+00:00 app[web.1]:     at module.exports (/app/controllers/process.js:126:27)
2020-03-22T18:01:39.749090+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2020-03-22T18:01:39.749090+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/route.js:137:13)
2020-03-22T18:01:39.749091+00:00 app[web.1]:     at /app/server.js:169:14
2020-03-22T18:01:39.749091+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2020-03-22T18:01:39.749091+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/route.js:137:13)
2020-03-22T18:01:39.749091+00:00 app[web.1]:     at /app/server.js:144:14
2020-03-22T18:01:39.749092+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2020-03-22T18:01:39.749092+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/route.js:137:13)
2020-03-22T18:01:39.749092+00:00 app[web.1]:     at /app/server.js:129:14
2020-03-22T18:01:39.749093+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2020-03-22T18:01:39.749171+00:00 app[web.1]: (node:24) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
2020-03-22T18:01:39.749239+00:00 app[web.1]: (node:24) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2020-03-22T18:02:09.723405+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/v3/entry/github/esporo/esporo/master/comments" host=esporo-staticman.herokuapp.com request_id=ebdaa58b-cb1f-4ceb-9a5e-dfd5997bdc2e fwd="138.36.184.66" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https

This only happens when trying to use the v3 endpoint, v2 works fine.

@arthrfrts which endpoint specifically are you trying to use?

@alexwaibel I'm trying to connect using /v3/connect/github/<username>/<repository>.

I have the same issue. Does anyone have a fix for it?

@arthrfrts @HarishMunagapati sorry I disappeared in the middle of assisting you with this. I've been quite busy lately and haven't had the necessary bandwidth to devote to this project. For now I'd recommend using v2 and authenticating using a token as that's the most stable and documented approach.

Sure, I'll reconfigure with v2 and comeback. When I did it yesterday, it's not showing the comments below the page.
let me give a shot again.

@alexwaibel @mmistakes Even v2 is not working now, can you please help me with documentation I'm using Minimal Mistakes, latest release v4.19.2

@alexwaibel I went trough them over multiple times from for last weekdays 😄

Here is things confusing me.
1 . "_config.yml" Staticman url entry
in "https://travisdowns.github.io/blog/2020/02/05/now-with-comments.html" its mentioned as

staticman_url: https://${bridge_app_name}.herokuapp.com/v2/entry/${github-username}/${blog-repo}/master/comments

and in "https://spinningnumbers.org/a/staticman-heroku.html" its mentioned as

staticmanUrl: https://spinningnumbers-staticmandev2.herokuapp.com/v2/entry/willymcallister/willymcallister.github.io/master/comments

either of them didn't who any logs in my Heroku app and I see the error
_"Sorry, there was an error with your submission. Please make sure all required fields have been completed and try again."_

But luckily today, this worked for me @mmistakes can update in the configuration document.
endpoint : "https://staticman-twn.herokuapp.com/v2/entry/"

Now I'm trying to figure out nested comments.

I had the same error ... I made my rsa private key in one line, without space and br

If you are hosting on GitHub pages, then use the "githubToken" key and remove the "gitlabToken" key. If you are hosting on GitLab pages, then use the "gitlabToken" key and remove the "githubToken" key.

The text for the "rsaPrivateKey" value should be changed to the text of your own private RSA key as a single-line string with \n newline characters.

@alexwaibel I just saw your comment and I would like to clarify that it's OK to have _both_ of the parameters. My GitHub _and_ GitLab (demo) projects linked to \@staticmanlab using the same Heroku app name provide a proof. However, I'm now reading about the recent developments so as to replace my old instance open to public with a personal one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tichter picture tichter  Â·  13Comments

PaulieScanlon picture PaulieScanlon  Â·  3Comments

robinmetral picture robinmetral  Â·  5Comments

mmistakes picture mmistakes  Â·  6Comments

eduardoboucas picture eduardoboucas  Â·  11Comments