Skip to content

[ERR_INVALID_ARG_TYPE]: The \"data\" argument must be of type string or an instance of Buffer, TypedArray, or DataView #259

Open
@nick-bull

Description

@nick-bull

Getting the following errors:

{"level":50,"time":1595942893309,"pid":16805,"hostname":"ip-xxx-xx-xxx-xx","name":"redbird","code":"ERR_INVALID_ARG_TYPE","msg":"Error registering LetsEncrypt certificates","stack":"TypeError [ERR_INVALID_ARG_TYPE]: The \"data\" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined\n    at writeFile (fs.js:1385:5)\n    at internal/util.js:297:30\n    at new Promise (<anonymous>)\n    at writeFile (internal/util.js:296:12)\n    at Object.stageAsync (/home/ubuntu/proxy/node_modules/safe-replace/index.js:65:14)\n    at Object.writeFileAsync (/home/ubuntu/proxy/node_modules/safe-replace/index.js:57:18)\n    at /home/ubuntu/proxy/node_modules/le-store-certbot/index.js:288:19","type":"Error","v":1}
{"level":30,"time":1595942893309,"pid":16805,"hostname":"ip-xxx-xx-xxx-xx","name":"redbird","msg":"Could not get any certs for api.someurl.com","v":1}

from the following configuration:

const redbird = require('redbird');
const proxy = redbird({
  port: 80,
  letsencrypt: {
    path: __dirname + '/certs',
    port: 9999
  },
  ssl: {
    http2: true,
    port: 443,
  },
});

proxy.register('api.someurl.com', 'http://localhost:3002', {
  ssl: {
    letsencrypt: {
      email: '[email protected]',
      production: true,
    }
  }
});

What is the data argument? Why is it undefined? Am I meant to create the certificates manually? The certs directory exists, and looks as I'd expect for ACME.


node: v14.5.0
npm: 6.14.5
package.json:

{
  "name": "proxy",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1",
    "redbird": "^0.10.0"
  }
}

Tested with node 10.22.0, 12.18.3, and latest. No success

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions