Skip to content
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 500 [InvalidAsn1Error]: encoding too long #454

Open
prateekdwv opened this issue Dec 25, 2022 · 1 comment
Open

Error 500 [InvalidAsn1Error]: encoding too long #454

prateekdwv opened this issue Dec 25, 2022 · 1 comment

Comments

@prateekdwv
Copy link

prateekdwv commented Dec 25, 2022

After deploying the app on Cyclic, every time when I post a comment, it fails with the following long.

2022-12-25 21:15:27.748: node:internal/crypto/sig:131
  const ret = this[kHandle].sign(data, format, type, passphrase, rsaPadding,
                            ^

Error: error:1E08010C:DECODER routines::unsupported
    at Sign.sign (node:internal/crypto/sig:131:29)
    at Object.sign (/var/task/node_modules/jwa/index.js:152:45)
    at Object.jwsSign [as sign] (/var/task/node_modules/jws/lib/sign-stream.js:32:24)
    at module.exports [as sign] (/var/task/node_modules/jsonwebtoken/sign.js:204:16)
    at getSignedJsonWebToken (/var/task/node_modules/@octokit/app/dist-node/index.js:31:30)
    at GitHub._authenticate (/var/task/lib/GitHub.js:58:21)
    at /var/task/lib/GitHub.js:31:32
    at new GitHub (/var/task/lib/GitHub.js:46:7)
    at module.exports.create (/var/task/lib/GitServiceFactory.js:11:14)
    at /var/task/lib/Staticman.js:32:35
    at new Staticman (/var/task/lib/Staticman.js:46:7)
    at module.exports (/var/task/controllers/process.js:126:27)
    at Layer.handle [as handle_request] (/var/task/node_modules/express/lib/router/layer.js:95:5)
    at next (/var/task/node_modules/express/lib/router/route.js:137:13)
    at /var/task/server.js:169:14
    at Layer.handle [as handle_request] (/var/task/node_modules/express/lib/router/layer.js:95:5)
    at next (/var/task/node_modules/express/lib/router/route.js:137:13)
    at /var/task/server.js:144:14
    at Layer.handle [as handle_request] (/var/task/node_modules/express/lib/router/layer.js:95:5)
    at next (/var/task/node_modules/express/lib/router/route.js:137:13)
    at /var/task/server.js:129:14
    at Layer.handle [as handle_request] (/var/task/node_modules/express/lib/router/layer.js:95:5) {
  library: 'DECODER routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_UNSUPPORTED'
}

Node.js v18.12.1
2022-12-25 21:15:27.775: 

ERROR: Failed to run "npm run start". Start script defined in package.json:

            "scripts": {
                "start":  "node index.js"
                 ...
            
Exited with code: 1

I guess it has something to do with my key configurations, but I'm not entirely sure. Can somebody help me figure out the issue here?

EDIT: With some effort, I realised the problem in my RSA private key. But I'm still getting the "errorCode": "GITHUB_READING_FILE"

{
  "success": false,
  "rawError": {
    "name": "HttpError",
    "status": 401,
    "headers": {
      "access-control-allow-origin": "*",
      "access-control-expose-headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
      "connection": "close",
      "content-length": "80",
      "content-security-policy": "default-src 'none'",
      "content-type": "application/json; charset=utf-8",
      "date": "Sun, 25 Dec 2022 16:21:07 GMT",
      "referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
      "server": "GitHub.com",
      "strict-transport-security": "max-age=31536000; includeSubdomains; preload",
      "vary": "Accept-Encoding, Accept, X-Requested-With",
      "x-content-type-options": "nosniff",
      "x-frame-options": "deny",
      "x-github-media-type": "github.v3; format=json",
      "x-github-request-id": "E440:3CDE:A32810:B2329E:63A87872",
      "x-ratelimit-limit": "60",
      "x-ratelimit-remaining": "59",
      "x-ratelimit-reset": "1671988867",
      "x-ratelimit-resource": "core",
      "x-ratelimit-used": "1",
      "x-xss-protection": "0"
    },
    "request": {
      "method": "GET",
      "url": "https://api.github.com/repos/prateekdwv/prateekdwv.github.io/contents/staticman.yml?ref=master",
      "headers": {
        "accept": "application/vnd.github.v3+json",
        "user-agent": "Staticman octokit.js/16.35.0 Node.js/18.12.1 (Linux 4.14; x64)",
        "authorization": "token [REDACTED]"
      },
      "request": {
        "timeout": 5000,
        "validate": {
          "owner": {
            "required": true,
            "type": "string"
          },
          "path": {
            "required": true,
            "type": "string"
          },
          "ref": {
            "type": "string"
          },
          "repo": {
            "required": true,
            "type": "string"
          }
        }
      }
    },
    "documentation_url": "https://docs.github.com/rest",
    "_smErrorCode": "GITHUB_READING_FILE"
  },
  "errorCode": "GITHUB_READING_FILE"
}
@Sicofonia
Copy link

Hi @prateekdwv , I've been trying to deploy Staticman on Vercel to use it as my commenting system in my Hugo generated static site. I came across the same problems as you, for me what was not working was the default branch name. In most tutorials they use master but my blog repo is based on a main branch. Once I replaced that in both my staticman.yml and my config.js I could get it up and running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants