gadicc / node-yahoo-finance2

Unofficial API for Yahoo Finance
https://www.npmjs.com/package/yahoo-finance2
MIT License
353 stars 58 forks source link

Using this package with Supabase/Deno #782

Open DDushkin opened 2 weeks ago

DDushkin commented 2 weeks ago

Bug Report

Describe the bug

I'm using the Supabase and I tried adding your package to their Edge functions (server-side TypeScript functions). Edge Functions are developed using Deno. It seems there are problems with running this on Deno. Here is what I see in logs when I try to run yahoo-finance:

⚠️ WARNING! This package (i.e. `yahoo-finance2`) is being used in the browser. Trying to use this may not work because of CORS. Be aware of that (and don't file issues for help with that). You can use a proxy to make CORS errors disappear, but we will not help you with that. Please read the README (https://github.com/gadicc/node-yahoo-finance2) for more details.

err TypeError: p.headers.raw is not a function
    at pe (https://esm.sh/v135/yahoo-finance2@2.11.3/esnext/yahoo-finance2.mjs:3:4675)
    at eventLoopTick (ext:core/01_core.js:64:7)
    at async Object.Ie [as _fetch] (https://esm.sh/v135/yahoo-finance2@2.11.3/esnext/yahoo-finance2.mjs:3:8861)
    at async Object.We [as _moduleExec] (https://esm.sh/v135/yahoo-finance2@2.11.3/esnext/yahoo-finance2.mjs:27:666)
    at async Object.x [as quote] (https://esm.sh/v135/yahoo-finance2@2.11.3/esnext/yahoo-finance2.mjs:27:7503)
    at async getQuotesByTickerSymbols 

Minimal Reproduction

import yahooFinance from 'https://esm.sh/yahoo-finance2';

const tickerSymbols = tickers.map((ticker) => ticker.symbol);
const quotes = await yahooFinance.quote(tickerSymbols);

Environment

Browser or Node: Deno Node version (if applicable): Npm version: Browser verion (if applicable): Library version (e.g. 1.10.1): 2.11.3

Additional Context

Any idea is it possible to run on Deno?