Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Error when uploading PDF #3

@kevlened

Description

@kevlened

After running the example code (download dummy.pdf here):

const { Remarkable } = require('remarkable-typescript');
const fs = require('fs');

(async () => {
  const client = new Remarkable({
    token: 'MY_TOKEN'
  });

  const myPDF = fs.readFileSync('dummy.pdf');
  await client.uploadPDF('My PDF name', myPDF);
})();

I get:

/var/folders/03/7z1lvqn567l7xvzhmdwj3fcc0000gn/T/dummy.pdf
(node:99384) UnhandledPromiseRejectionWarning: GotError: Cannot read property 'startsWith' of undefined
    at get (/node_modules/got/dist/source/request-as-event-emitter.js:200:27)
    at urlToOptions (internal/url.js:1259:28)
    at Object.request (https.js:279:15)
    at Object.<anonymous> (/node_modules/agent-base/patch-core.js:25:22)
    at get (/node_modules/got/dist/source/request-as-event-emitter.js:197:65)
(node:99384) 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(). (rejection id: 1)
(node:99384) [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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions