reMarkable-typescript icon indicating copy to clipboard operation
reMarkable-typescript copied to clipboard

Error when uploading PDF

Open kevlened opened this issue 5 years ago • 1 comments

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.

kevlened avatar Feb 28 '20 00:02 kevlened

I get the same error but with UnhandledPromiseRejectionWarning: GotError: Cannot read property 'Success' of undefined

aqwzs avatar Sep 01 '21 14:09 aqwzs