gadicc / node-yahoo-finance2

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

Invalid Cookie or Invalid Crumb for options #736

Closed mhozic closed 4 months ago

mhozic commented 4 months ago

Bug Report

Describe the bug

When yahooFinance.options is called, "Invalid Cookie" or "Invalid Crumb" error is returned

Minimal Reproduction

const response = yahooFinance.options('AYX') throws "Invalid Cookie" or "Invalid Crumb" error

Environment

Browser or Node: node Node version (if applicable): 14.18.2 Npm version: 6.14.15 Library version: 2.9.0

Additional Context

/v6/finance/options/ endpoint doesn't produce this error /v7/finance/options/ needs a crumb (needsCrumb: true)

gadicc commented 4 months ago

Thanks, @mhozic, for the report and helpful context, which led to an easy quick for for this :pray:

This will be in the next release and there'll be an automated message here when that happens.

gadicc commented 4 months ago

:tada: This issue has been resolved in version 2.9.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

samducker commented 4 months ago

Hi its working on restart of my server, but then seems to stop working within 10-20mins.

My server is based in US EAST. How can I force the cookie to renew on each request?

Is there a way to force cookie refresh if I get an error like this?

I am running a honojs server on railway with no serverless (its constantly running). Naturally storing the cookie in a volume, doesn't seem to make any sense if I'm needing to refresh the cookie.

samducker commented 4 months ago

cc: @gadicc

gadicc commented 4 months ago

Sam, thanks for the report, the ping and your patience. I just got back from a long overseas trip and am catching up on everything. I hope to get to this on Sunday or Monday 🙏

On Wed, 28 Feb 2024, 15:39 Sam Ducker, @.***> wrote:

cc: @gadicc https://github.com/gadicc

— Reply to this email directly, view it on GitHub https://github.com/gadicc/node-yahoo-finance2/issues/736#issuecomment-1969254901, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC5IGS4GOQ47VR77TKLUNDYV5FU3AVCNFSM6AAAAABCWT2HKKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRZGI2TIOJQGE . You are receiving this because you were mentioned.Message ID: @.***>

samducker commented 4 months ago

No worries thank you for this library and your amazing work @gadicc I felt bad to tag :D, but I have a client on my back.

In the meantime I introduced a caching solution on my end which has limited the impact of my problem. So no worries, enjoy the weekend.

Happy to follow up with my sentry logs if helpful.

p.s.

I am happy to submit a PR, if you can point me in the right direction also <3!