-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Missing constant in axios/lib/adapters/http.js zlibOptions #5888
Description
Describe the bug
I'm in the process of upgrading our Rails app (running Rails 6.1) with ESBUILD to compile all js libraries. We have axios being imported through yarn. The issue appears when I upgrade axios to any version greater than 1.2.0. Once the JS is compiled and I load my page, in the browser console, I see this error (Uncaught TypeError: Cannot read properties of undefined (reading 'Z_SYNC_FLUSH'):
To Reproduce
I'm not sure how you would reproduce this error in any setup except mine. I looked online to see if anyone else was seeing this issue and didn't find anything. All I can tell you is that I'm running Rails 6.1, with Ruby 2.7.5, with ESBUILD, jsbunding-rails, etc. JS libraries are installed via yarn 1.22.19. Once ESBUILD compiles, I reload my webpage and this bug appears. If I downgrade to axios version 1.2.0 the bug goes away. If I upgrade to version 1.2.1 or greater, the bug appears.
Code snippet
The bug is coming from here:
// ../../node_modules/axios/lib/adapters/http.js
init_events();
var zlibOptions = {
flush: exports12.constants.Z_SYNC_FLUSH,
finishFlush: exports12.constants.Z_SYNC_FLUSH
};Expected behavior
Should not see an error for a missing constant
Axios Version
>=1.2.1
Adapter Version
http
Browser
Brave
Browser Version
1.57.62
Node.js Version
20.5.1
OS
OSX 13.5.1
Additional Library Versions
├─ @esbuild-plugins/node-resolve@0.2.2
├─ esbuild-plugin-import-glob@0.1.1
├─ esbuild-plugin-polyfill-node@0.3.0
├─ esbuild-rails@1.0.7
├─ esbuild@0.19.2
Additional context/Screenshots
No response
