tinylibs icon indicating copy to clipboard operation
tinylibs copied to clipboard

Bug: Runtime Type Error in Cache-Parser Where Header Token Contains no ,

Open nagilson opened this issue 1 month ago • 16 comments

What happened?

This code: https://github.com/arthurfiorette/tinylibs/blob/main/packages/cache-parser/src/util.ts#L18 , which this library seems to depend on, is failing at runtime for us in a rare number of cases.

(I was very relieved to see you manage both libraries, so thank you for the work you do :). )

My very quick glance is the problem is the code seems to rely on the fact that , is in the header of the string that is passed to it. I dont think that assumption can always hold true, so sometimes the token ends up being null or a type other than string, so when .split is called on it, there becomes an uncaught runtime error. The split on line 22 is the culprit.

I don't know much more of the context of the code here and there might be some other reason, but that is my suspicion. Example is https://github.com/dotnet/vscode-dotnet-runtime/issues/1734. I don't have a repro, this info is garnered from customers.   It is causing some issues for us over in VS Code land and it is one of our highest causes of failure, causing roughly .01% out of several million customers to fail, with a high report rate on mac os sonoma silicon m1.

axios-cache-interceptor version

^1.0.1

Node / Browser Version

16

Axios Version

^1.3.4

What storage is being used

Memory Storage

Relevant debugging log output

Failed: n[r].split is not a function. Aborting. Stack: TypeError: n[r].split is not a function
    at /usr/local/google/home/USER/.vscode-insiders/extensions/ms-dotnettools.vscode-dotnet-runtime-2.0.5/javascript/esm|c:\Users\USER\vscode-dotnet-runtime\vscode-dotnet-runtime-library\node_modules\cache-parser\dist\index.mjs:1:425
    at parse (/usr/local/google/home/USER/.vscode-insiders/extensions/ms-dotnettools.vscode-dotnet-runtime-2.0.5/javascript/esm|c:\Users\USER\vscode-dotnet-runtime\vscode-dotnet-runtime-library\node_modules\cache-parser\dist\index.mjs:1:327)
    at Function.headerInterpreter (/usr/local/google/home/USER/.vscode-insiders/extensions/ms-dotnettools.vscode-dotnet-runtime-2.0.5/javascript/dynamic|c:\Users\USER\vscode-dotnet-runtime\vscode-dotnet-runtime-library\node_modules\axios-cache-interceptor\dist\index.cjs:2:1324)
    at n (/usr/local/google/home/USER/.vscode-insiders/extensions/ms-dotnettools.vscode-dotnet-runtime-2.0.5/javascript/dynamic|c:\Users\USER\vscode-dotnet-runtime\vscode-dotnet-runtime-library\node_modules\axios-cache-interceptor\dist\index.cjs:2:5445)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Pt.request (/usr/local/google/home/USER/.vscode-insiders/extensions/ms-dotnettools.vscode-dotnet-runtime-2.0.5/javascript/dynamic|c:\Users\USER\vscode-dotnet-runtime\vscode-dotnet-runtime-library\node_modules\axios\dist\node\axios.cjs:3872:7)
    at Pt.request (/usr/local/google/home/USER/.vscode-insiders/extensions/ms-dotnettools.vscode-dotnet-runtime-2.0.5/javascript/dynamic|c:\Users\USER\vscode-dotnet-runtime\vscode-dotnet-runtime-library\node_modules\axios\dist\node\axios.cjs:3877:41)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

nagilson avatar May 08 '24 21:05 nagilson