usechainlinkfunctions icon indicating copy to clipboard operation
usechainlinkfunctions copied to clipboard

MTA fair price tollbooth HighWei - npm package support for puppeteer to XPATH scrape?

Open MarcusWentz opened this issue 2 years ago • 2 comments
trafficstars

Questions:

  1. Can we use custom node.js libraries somehow?

I tried:

npm i puppeteer

but get error:

__Error thrown in sandboxed source code__
Cannot find module 'puppeteer'
__Simulated On-Chain Response__
Error message returned to client contract: "Cannot find module 'puppeteer'"
  1. Can
Functions.makeHttpRequest

return an object which can be XPATH scraped in a simple way?

MarcusWentz avatar Jul 26 '23 02:07 MarcusWentz

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
usechainlinkfunctions ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 26, 2023 2:58am

vercel[bot] avatar Jul 26 '23 02:07 vercel[bot]

Hi @MarcusWentz, I'll try to answer your questions.

re: 1. Can we use custom node.js libraries somehow?

-At the moment, no, only vanilla Node.js features are supported. Check https://docs.chain.link/chainlink-functions/resources/service-limits for more info.

re: 2. Can Functions.makeHttpRequest return an object which can be XPATH scraped in a simple way?

-To my best knowledge, it is possible in theory, most likely as a responseType 'document' or 'text', but you will need to handle interpreting XPATH by yourself without using external NPM libraries since XPATH natively isn't a feature of Node.js

andrejrakic avatar Jul 30 '23 21:07 andrejrakic