Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using this package with Supabase/Deno #782

Open
DDushkin opened this issue Jun 13, 2024 · 2 comments
Open

Using this package with Supabase/Deno #782

DDushkin opened this issue Jun 13, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@DDushkin
Copy link

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/[email protected]/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/[email protected]/esnext/yahoo-finance2.mjs:3:8861)
    at async Object.We [as _moduleExec] (https://esm.sh/v135/[email protected]/esnext/yahoo-finance2.mjs:27:666)
    at async Object.x [as quote] (https://esm.sh/v135/[email protected]/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?

@DDushkin DDushkin added the bug Something isn't working label Jun 13, 2024
@eddie-atkinson
Copy link
Collaborator

Possibly related to #719

@eddie-atkinson
Copy link
Collaborator

eddie-atkinson commented Aug 17, 2024

Just confirming from my own work, this is related to the use of node-fetch which has weird/non-standard around headers. My PR #793 will drop node-fetch in favour of the Node18 stdlib implementation which should resolve this issue. Can't guarantee this package will magically support Deno after that, but there's a pretty good chance it will

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants