Open IgorKowalczyk opened 4 years ago
@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 git@github.com:IgorKowalczykBot/staticman.git
(My fork for the repository - current) and the console shows such an error as in the picture.
EDIT:
If I copy the original repository (git clone git@github.com: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.
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/
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.
@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:
ssh-keygen -t rsa -b 4096 -C "staticman key" -f ~/.ssh/staticman_key
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]: > staticman@3.0.0 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]: > staticman@3.0.0 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]: > staticman@3.0.0 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]: > staticman@3.0.0 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.
I go to the dev
branch on the original project and click on the readme
button "Deploy to Heroku"
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.
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:
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
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
@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"}
Below is Heroku app log:
@IgorKowalczyk to be clear, when using puttygen you must:
(Get-Content 'C:\username\Downloads\keyfile') -join '' | Set-Content 'C:\username\Downloads\keyfile'
ensuring you replace the path with your key path.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.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.
When I try to send data to your API that works on Heroku, I get an "Application error" message just like in the picture.
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.