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

Problem fetching quotes, "unsupported redirect" #777

Open
shaneikennedy opened this issue May 30, 2024 · 8 comments
Open

Problem fetching quotes, "unsupported redirect" #777

shaneikennedy opened this issue May 30, 2024 · 8 comments
Labels
bug Something isn't working released

Comments

@shaneikennedy
Copy link

shaneikennedy commented May 30, 2024

Bug Report

Describe the bug

Please consider completing the survey at https://bit.ly/yahoo-finance-api-feedback if you haven't already; for more info see https://github.com/gadicc/node-yahoo-finance2/issues/764#issuecomment-2056623851.
09:38:27.142 Fetching crumb and cookies from https://finance.yahoo.com/quote/AAPL...
09:38:27.361 fetch https://guce.yahoo.com/consent?brandType=nonEu&gcrumb=UjqZDCU&done=https%3A%2F%2Ffinance.yahoo.com%2Fquote%2FAAPL
09:38:27.706 fetch https://consent.yahoo.com/v2/collectConsent?sessionId=3_cc-session_33add8e1-9cbf-429f-b0aa-bc0e5896c57b
09:38:28.093 fetch https://consent.yahoo.com/v2/collectConsent?sessionId=3_cc-session_33add8e1-9cbf-429f-b0aa-bc0e5896c57b
09:38:28.184 fetch https://guce.yahoo.com/copyConsent?sessionId=3_cc-session_33add8e1-9cbf-429f-b0aa-bc0e5896c57b&lang=sv-SE
09:38:28.268 Fetching crumb and cookies from https://finance.yahoo.com/quote/AAPL?guccounter=1...
09:38:28.355 Error: Unsupported redirect to https://finance.yahoo.com/quote/AAPL/, please report.
    at _getCrumb (/Users/shane.kennedy/.config/raycast/extensions/quotes/index.js:27889:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async _getCrumb (/Users/shane.kennedy/.config/raycast/extensions/quotes/index.js:27886:16)
09:38:28.355 Error: Unsupported redirect to https://finance.yahoo.com/quote/AAPL/, please report.
    at _getCrumb (/Users/shane.kennedy/.config/raycast/extensions/quotes/index.js:27889:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async _getCrumb (/Users/shane.kennedy/.config/raycast/extensions/quotes/index.js:27886

Minimal Reproduction

await yahooFinance.quote('AAPL')

Environment

Browser or Node:
Node version (if applicable): 20.12.0
Npm version: 10.5.0
Library version (e.g. 1.10.1): "yahoo-finance2": "^2.11.0"

@shaneikennedy shaneikennedy added the bug Something isn't working label May 30, 2024
@shaneikennedy shaneikennedy changed the title Problem fetching quotes, "unsupported redirect Problem fetching quotes, "unsupported redirect" May 30, 2024
@dinhminhx
Copy link

Same issue here

@gadicc gadicc closed this as completed in 2e4c0b4 May 30, 2024
gadicc pushed a commit that referenced this issue May 30, 2024
## [2.11.3](v2.11.2...v2.11.3) (2024-05-30)

### Bug Fixes

* **getCrumb:** ignore (but log) unexpected redirect (fixes [#777](#777)) ([2e4c0b4](2e4c0b4))
@gadicc
Copy link
Owner

gadicc commented May 30, 2024

🎉 This issue has been resolved in version 2.11.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gadicc
Copy link
Owner

gadicc commented May 30, 2024

Hey all, thanks for reporting.

I've released a workaround for this. Instead of failing, it will just log and continue, and everything seems to be working fine -- for now. However, it looks like Yahoo are in the middle of some changes and things may well break again soon. So please do report any further breakages.

🙏

@shaneikennedy
Copy link
Author

@gadicc Thanks for this project and constantly going to war with yahoo for us all 🫡

@gadicc
Copy link
Owner

gadicc commented May 30, 2024

For sure, my pleasure. Definitely not going to war against Yahoo though 😅 Have made a lot of effort to make sure the library "plays nice" with their services and team, and so far so good 🙏

@Abudibro
Copy link

Abudibro commented Nov 4, 2024

This is no longer working again, not sure if this is an issue on my end or not

Fetching crumb and cookies from https://finance.yahoo.com/quote/AAPL?guccounter=1...
Error: Unsupported redirect to https://finance.yahoo.com/quote/AAPL/, please report.
    at _getCrumb (/Users/abdurahmanhijazi/dev/stock-option-screener/netlify/node_modules/yahoo-finance2/dist/esm/src/lib/getCrumb.js:130:19)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at _getCrumb (/Users/abdurahmanhijazi/dev/stock-option-screener/netlify/node_modules/yahoo-finance2/dist/esm/src/lib/getCrumb.js:126:24)
    at Object.yahooFinanceFetch [as _fetch] (/Users/abdurahmanhijazi/dev/stock-option-screener/netlify/node_modules/yahoo-finance2/dist/esm/src/lib/yahooFinanceFetch.js:53:23)
    at Object.moduleExec [as _moduleExec] (/Users/abdurahmanhijazi/dev/stock-option-screener/netlify/node_modules/yahoo-finance2/dist/esm/src/lib/moduleExec.js:52:18)
    at /Users/abdurahmanhijazi/dev/stock-option-screener/netlify/functions/quote.js:19:25
Response with status 304 in 1089 ms.

@gadicc
Copy link
Owner

gadicc commented Nov 4, 2024

@Abudibro, for what query? I tried with quote("AAPL") and it works.

From time to time there are issues with Yahoo's servers that can cause issues like this. They usually resolve themselves within a few hours, with no action on our part.

What country are you in? Sometimes these issues are region-specific (as it only affects servers in one region). You could try a VPN to change countries and see if it makes any difference (try somewhere far away, e.g. US vs EU vs EMEA etc).

If you do find an issue specific to a region, and one that doesn't resolve itself within a day or so, unfortunately I won't have a chance to look into this further until next week :/

@gadicc gadicc reopened this Nov 4, 2024
@Abudibro
Copy link

Abudibro commented Nov 4, 2024

@gadicc The bug is happening for the quote and quoteSummary functions. I am in the same country as you, UK. So it can't be a region thing.

The strange thing is that other ones work, for example the suggestion function works as normal but the quote and quoteSummary ones are giving me issues.

If I find out what the issue is I'll post it here, maybe it'll save someone else in the future some headache lol

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

No branches or pull requests

4 participants