node-instapaper icon indicating copy to clipboard operation
node-instapaper copied to clipboard

getText throws "generic error"

Open taitems opened this issue 6 years ago • 3 comments

Firstly, thank you of course for making this plugin. I've pulled it down and am giving it a go for the first time today.

For some reason, I can't get the getText method to work and the error message is not particular helpful. I can load the bookmark list fine, so it's not an auth issue.

I looked at the docs and said all input must be UTF-8, so I verified my script was UTF-8. I've tried the bookmark_id as a straight Int 1024240997, and as a String '1024240997'. I've tried the hash instead 'oua8wDvO'. I've tried promise chaining. Normal callback function as a parameter. Nothing seems to work.

A cut down example is here:

const credentials = require('./credentials.js')
const Instapaper  = require('instapaper');
const client      = Instapaper(credentials.instapaperToken, credentials.instapaperSecret);
 
client.setUserCredentials(credentials.instapaperUsername, credentials.instapaperPassword);

client.bookmarks.getText(1024240997).then((response) => {
	console.log(response);
});

Which produces the following error message:

Unhandled rejection GenericError: An error occurred
    at new NewError (/Users/taitems/Projects/circular/node_modules/custom-error/index.js:14:13)
    at Instapaper.<anonymous> (/Users/taitems/Projects/circular/node_modules/instapaper/lib/index.js:114:23)
    at runCallback (timers.js:781:20)
    at tryOnImmediate (timers.js:743:5)
    at processImmediate [as _immediateCallback] (timers.js:714:5)
From previous event:
    at Instapaper.request (/Users/taitems/Projects/circular/node_modules/instapaper/lib/index.js:107:21)
    at Bookmarks.getText (/Users/taitems/Projects/circular/node_modules/instapaper/lib/index.js:154:22)
    at Object.<anonymous> (/Users/taitems/Projects/circular/app.js:7:18)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Function.Module.runMain (module.js:609:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:598:3

taitems avatar Mar 17 '18 09:03 taitems

It looks like the OAuth library that I've used is broken in recent versions of Node 🙁

I've tried some quick fixes but none of them worked, so it might be best to consider an alternative (I just tested instapaper-node-sdk which seems to work just fine).

robertklep avatar Mar 17 '18 12:03 robertklep

Different repo, but the head here worked for me (Node v12): https://github.com/codiechanel/instapaper-node-sdk

jeffreypriebe avatar Feb 23 '20 07:02 jeffreypriebe

Thanks for the suggestion. I really was hoping to use this library mainly for getText and it's unfortunate that's like the only thing that isn't working.

Fleker avatar Apr 02 '23 17:04 Fleker