snowflake-connector-nodejs icon indicating copy to clipboard operation
snowflake-connector-nodejs copied to clipboard

TypeError: Cannot read properties of undefined (reading 'set') at OcspResponseCache.set

Open pavannarayan05 opened this issue 3 years ago • 3 comments

I am using node version v17.9.0. OS is Linux. I am using Kubernetes and launching a nodejs application to connect with snowflake and execute a query.

version of snowflake-promise is 2.2.0. version of snowflake-sdk is 1.6.14.

I am getting below error while connecting to snowflake. Can you please suggest.

/app/node_modules/snowflake-sdk/lib/agent/ocsp_response_cache.js:157
    cache.set(certId, response);
          ^
TypeError: Cannot read properties of undefined (reading 'set')
    at OcspResponseCache.set (/app/node_modules/snowflake-sdk/lib/agent/ocsp_response_cache.js:157:11)
    at /app/node_modules/snowflake-sdk/lib/agent/socket_util.js:232:32
    at done (/app/node_modules/snowflake-sdk/lib/agent/check.js:142:5)
    at ocspResponseVerify (/app/node_modules/snowflake-sdk/lib/agent/check.js:201:7)
    at done (/app/node_modules/snowflake-sdk/lib/agent/check.js:71:7)
    at IncomingMessage.<anonymous> (/app/node_modules/snowflake-sdk/lib/agent/check.js:99:7)
    at IncomingMessage.emit (node:events:539:35)
    at IncomingMessage.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1345:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

pavannarayan05 avatar Oct 18 '22 17:10 pavannarayan05

I have also just seen this today. We have not updated snowflake-sdk recently. We remain on 1.6.11.

markandrus avatar Nov 03 '22 09:11 markandrus

I have also just seen this today. We have not updated snowflake-sdk recently. We remain on 1.6.11.

Please do let me know if you find out something Mark. Would be of great help!

pavannarayan05 avatar Nov 03 '22 11:11 pavannarayan05

In my case, a retry was sufficient, so I'm not sure what the root cause was.

markandrus avatar Nov 03 '22 16:11 markandrus

We would also love to hear an update on this

yakkomajuri avatar Nov 28 '22 01:11 yakkomajuri

I stopped getting this error after 3 weeks without any change made. Luckily, this was in Dev. I hope I don't see this in Production because I dont have a solution if this error occurs again. Any suggestions are welcome.

pavannarayan05 avatar Nov 28 '22 08:11 pavannarayan05

From my digging the SDK uses the filesystem to keep some sort of cache and it throws if it can't set the cache. This might be completely anecdotal but we have seen this at times of high CPU usage in our app, so I'm wondering if that plays a role.

Nevertheless, given we're talking about a cache, is it possible to try-catch this as a temporary stopgap? This (seemingly) randomly crashes our server and I'd rather it didn't if the cache is not a core piece of functionality (I'd assume it isn't?)

cc @SimbaGithub @sfc-gh-kdama

yakkomajuri avatar Nov 28 '22 12:11 yakkomajuri

managed to reproduce the problem. at least for me, it comes when the

  • local OCSP cache file is not present so the driver would need to download it from the remote cache (ocsp.snowflakecomputing.com)
  • an artificial delay of 5s is introduced with tc on the interface which is used to internet-bound communications (thank you for the idea @yakkomajuri , hinting CPU usage might play a role)

will coordinate internally to see how best address this

sfc-gh-dszmolka avatar Nov 29 '22 13:11 sfc-gh-dszmolka

great, thanks for looking into this!

yakkomajuri avatar Nov 29 '22 14:11 yakkomajuri

I'm monitoring, any major update so far on that issue ?

guillaume-chech avatar Dec 12 '22 13:12 guillaume-chech

no update yet, thank you all for bearing with us. Will post if any important progress or the PR is available for the fix.

sfc-gh-dszmolka avatar Dec 12 '22 14:12 sfc-gh-dszmolka

@sfc-gh-ext-simba-ti, the team is asking for an update on this ticket, I see it has been merged, is it fixed?

sfc-gh-sfaber avatar Jan 11 '23 16:01 sfc-gh-sfaber

hey folks quick update. the team is still working on the PR (see above), hopefully we can get it out soon. for those who are heavily impacted and need an immediate relief; you can try to disable the OCSP checks in the connector (by adding snowflake.configure({ insecureConnect: true });)

of course this is not recommended on the long term, just putting it out here as a possible and temporal mitigation while the proper fix is underway. thank you for bearing with us !

sfc-gh-dszmolka avatar Jan 26 '23 13:01 sfc-gh-dszmolka