Promise within Coda Pack using CLI?

I am trying to use this Node package within a Pack which I am writing from the command line:

As an initial test of compatibility I am trying to add this sample code from the NPM documentation.

If I place this code inside my Async function I get an error saying “Cannot read properties of undefined.”

What would be the proper way to use this Node package within a Pack?

var ncbi = require('node-ncbi');
const pubmed = ncbi.pubmed;
 
pubmed.summary(20517925).then((paper) => {
  console.log(paper);
});

Hi @Richard_Kaplan - Libraries that make HTTP requests typically won’t work in Packs. This is because the Packs Runtime only allows HTTP requests through our custom Fetcher interface, and libraries like this use Node’s built-in networking features.

1 Like