gadicc / node-yahoo-finance2

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

ERROR [YahooFinanceService] FetchError: Hostname/IP does not match certificate's altnames: Host: guce.yahoo.com. is not in the cert's altnames: DNS:app.groenopruiming.com, DNS:groenopruiming.com #798

Closed SitramSoft closed 1 week ago

SitramSoft commented 1 week ago

Bug Report

After a certain period of time, I cannot get quotes from YahooFinance when I access the app from the browser when running Ghostfolio in docker.

Describe the bug

I run Ghostfolio in Docker so I can access it remotely trough a subdomain I own. This means the container is running 24/7(minus eventual downtimes).

After a certain period of time, I cannot see quotes for the symbols I have defined and docker logs show a lot of messages similar with the one below:

[Nest] 260  - 09/18/2024, 12:29:43 PM     LOG [PortfolioSnapshotProcessor (PORTFOLIO)] Portfolio snapshot calculation of user 'xxx' has been started
[Nest] 260  - 09/18/2024, 12:29:43 PM    WARN [YahooFinanceService] Fallback to yahooFinance.quoteSummary()
[Nest] 260  - 09/18/2024, 12:29:43 PM   ERROR [YahooFinanceService] FetchError: request to https://guce.yahoo.com/consent?brandType=nonEu&gcrumb=XMWcb28&done=https%3A%2F%2Ffinance.yahoo.com%2Fquote%2FAAPL failed, reason: Hostname/IP does not match certificate's altnames: Host: guce.yahoo.com. is not in the cert's altnames: DNS:app.groenopruiming.com, DNS:groenopruiming.com
[Nest] 260  - 09/18/2024, 12:29:43 PM   ERROR [YahooFinanceService] Could not get quote summary for IBKR
[Nest] 260  - 09/18/2024, 12:29:43 PM   ERROR [YahooFinanceService] Could not get quote summary for NFLX
[Nest] 260  - 09/18/2024, 12:29:43 PM   ERROR [YahooFinanceService] Could not get quote summary for NVDA
[Nest] 260  - 09/18/2024, 12:29:43 PM     LOG [PortfolioSnapshotProcessor (PORTFOLIO)] Portfolio snapshot calculation of user 'xxx' has been completed in 0.264 seconds
[Nest] 260  - 09/18/2024, 12:29:53 PM    WARN [YahooFinanceService] Fallback to yahooFinance.quoteSummary()
[Nest] 260  - 09/18/2024, 12:29:53 PM   ERROR [YahooFinanceService] FetchError: request to https://guce.yahoo.com/consent?brandType=nonEu&gcrumb=XMWcb28&done=https%3A%2F%2Ffinance.yahoo.com%2Fquote%2FAAPL failed, reason: Hostname/IP does not match certificate's altnames: Host: guce.yahoo.com. is not in the cert's altnames: DNS:app.groenopruiming.com, DNS:groenopruiming.com
[Nest] 260  - 09/18/2024, 12:29:53 PM   ERROR [YahooFinanceService] Could not get quote summary for ^SPX
[Nest] 260  - 09/18/2024, 12:29:53 PM   ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'currency')
TypeError: Cannot read properties of undefined (reading 'currency')
    at BenchmarkService.getMarketDataForUser (/ghostfolio/apps/api/main.js:1:328723)

After restarting the docker container I get the following messages in log and the quotes for all my symbols are correctly shown.

[Nest] 260  - 09/18/2024, 12:42:39 PM     LOG [NestApplication] Nest application successfully started +130ms
[Nest] 260  - 09/18/2024, 12:42:39 PM     LOG    ________               __  ____      ___
[Nest] 260  - 09/18/2024, 12:42:39 PM     LOG   / ____/ /_  ____  _____/ /_/ __/___  / (_)___
[Nest] 260  - 09/18/2024, 12:42:39 PM     LOG  / / __/ __ \/ __ \/ ___/ __/ /_/ __ \/ / / __ \
[Nest] 260  - 09/18/2024, 12:42:39 PM     LOG / /_/ / / / / /_/ (__  ) /_/ __/ /_/ / / / /_/ /
[Nest] 260  - 09/18/2024, 12:42:39 PM     LOG \____/_/ /_/\____/____/\__/_/  \____/_/_/\____/ 2.108.0
[Nest] 260  - 09/18/2024, 12:42:39 PM     LOG 
[Nest] 260  - 09/18/2024, 12:42:39 PM     LOG Listening at http://0.0.0.0:3333
[Nest] 260  - 09/18/2024, 12:42:39 PM     LOG 
[Nest] 260  - 09/18/2024, 12:44:30 PM   ERROR [ExchangeRateDataService] No exchange rate has been found for EURUSD
[Nest] 260  - 09/18/2024, 12:44:30 PM   ERROR [ExchangeRateDataService] No exchange rate has been found for EURUSD
[Nest] 260  - 09/18/2024, 12:44:30 PM     LOG [PortfolioSnapshotProcessor (PORTFOLIO)] Portfolio snapshot calculation of user 'xxx' has been started
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.
Fetching crumb and cookies from https://finance.yahoo.com/quote/AAPL...
fetch https://guce.yahoo.com/consent?brandType=nonEu&gcrumb=Cwz-hUc&done=https%3A%2F%2Ffinance.yahoo.com%2Fquote%2FAAPL
fetch https://consent.yahoo.com/v2/collectConsent?sessionId=3_cc-session_3532e590-7d5d-46eb-9fd0-621d5a25c15a
fetch https://consent.yahoo.com/v2/collectConsent?sessionId=3_cc-session_3532e590-7d5d-46eb-9fd0-621d5a25c15a
fetch https://guce.yahoo.com/copyConsent?sessionId=3_cc-session_3532e590-7d5d-46eb-9fd0-621d5a25c15a&lang=ro-RO
Fetching crumb and cookies from https://finance.yahoo.com/quote/AAPL?guccounter=1...
We expected a redirect to guce.yahoo.com, but got https://finance.yahoo.com/quote/AAPL/
We'll try to continue anyway - you can safely ignore this if the request succeeds
Success. Cookie expires on Infinity
fetch https://query1.finance.yahoo.com/v1/test/getcrumb
New crumb: A1eKi3Ko9wO
[Nest] 260  - 09/18/2024, 12:44:31 PM   ERROR [YahooFinanceService] Error: User is unable to access this feature - https://bit.ly/yahoo-finance-api-feedback
[Nest] 260  - 09/18/2024, 12:44:31 PM    WARN [YahooFinanceService] Fallback to yahooFinance.quoteSummary()
[Nest] 260  - 09/18/2024, 12:44:31 PM   ERROR [YahooFinanceService] Could not get quote summary for IBKR
[Nest] 260  - 09/18/2024, 12:44:32 PM     LOG [PortfolioSnapshotProcessor (PORTFOLIO)] Portfolio snapshot calculation of user 'xxx' has been completed in 2.070 seconds
[Nest] 260  - 09/18/2024, 12:44:32 PM   ERROR [ExchangeRateDataService] No exchange rate has been found for EURUSD
[Nest] 260  - 09/18/2024, 12:44:32 PM   ERROR [ExchangeRateDataService] No exchange rate has been found for EURUSD
[Nest] 260  - 09/18/2024, 12:44:32 PM   ERROR [ExchangeRateDataService] No exchange rate has been found for EURUSD
[Nest] 260  - 09/18/2024, 12:44:32 PM   ERROR [ExchangeRateDataService] No exchange rate has been found for EURUSD
[Nest] 260  - 09/18/2024, 12:44:32 PM   ERROR [ExchangeRateDataService] No exchange rate has been found for EURUSD
[Nest] 260  - 09/18/2024, 12:44:32 PM   ERROR [ExchangeRateDataService] No exchange rate has been found for EURUSD
[Nest] 260  - 09/18/2024, 12:44:32 PM   ERROR [BenchmarkService] No historical market data has been found for ^SPX (YAHOO) at 2023-12-31
[Nest] 260  - 09/18/2024, 12:45:16 PM   ERROR [ExchangeRateDataService] No exchange rate has been found for EURUSD
[Nest] 260  - 09/18/2024, 12:45:16 PM   ERROR [ExchangeRateDataService] No exchange rate has been found for EURUSD

My docker-compose.yaml:

ghostfolio:
    image: ghostfolio/ghostfolio:latest
    container_name: Ghostfolio
    env_file:
      - .env
    environment:
      DATABASE_URL: ${DATABASE_URL}
      NODE_ENV: production
      REDIS_HOST: ${REDIS_HOST}
      REDIS_PORT: ${REDIS_PORT}
    ports:
      - 3333:3333
    restart: unless-stopped

DATABASE_URL has the following value. Each of the remaining variables are my user, host and password for the Postgres docker container.

DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}?sslmode=prefer

Minimal Reproduction

After a certain period of time of running the docker container.

Environment

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

Additional Context

SitramSoft commented 1 week ago

Wrong repo!