Skip to content
This repository has been archived by the owner on Feb 12, 2021. It is now read-only.

S3 module not working on node 12 #228

Open
shkedi opened this issue Oct 29, 2019 · 13 comments
Open

S3 module not working on node 12 #228

shkedi opened this issue Oct 29, 2019 · 13 comments

Comments

@shkedi
Copy link

shkedi commented Oct 29, 2019

I am running node version 12.13.0 (LTS)
and using the latest s3 module (4.4.0)
the module using with an old version of graceful-fs that was broken in node 12.
I am getting this error
ReferenceError: primordials is not defined
at fs.js:27:26
at req_ (/app/node_modules/natives/index.js:143:24)
at Object.req [as require] (/app/node_modules/natives/index.js:55:10)
at Object. (/app/node_modules/s3/node_modules/graceful-fs/fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/app/node_modules/s3/node_modules/graceful-fs/graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/app/node_modules/s3/lib/index.js:3:10)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)

@manimoto
Copy link

manimoto commented Nov 7, 2019

you need to update graceful-fs package of s3 to updated version it will work then. i had the same issue.

@shkedi
Copy link
Author

shkedi commented Nov 7, 2019

@manimoto Thanks for your answer.
I can't change manually the graceful-fs' version, it is in production and I can't change manually the package-lock.
It seems the module wasn't changed ~5 years, I think the solution will be to move to aws-sdk npm package

@sonicoder86
Copy link

Use the fork of this repo https://github.com/auth0/node-s3-client

@shkedi
Copy link
Author

shkedi commented Nov 15, 2019

Thanks @BlackSonic

@RajaBellebon
Copy link

I was trying to use the fork to replace our currently s3-cli that is calling s3 but faced weird issues where it seems that my files are uploaded but I can't access them..

Anyway, do you know if a proper fix or a new release with the fork will be done soon?

Thanks in advance

@MattBro
Copy link

MattBro commented Mar 12, 2020

Looks like there was a problem publishing the 4.4.0 version of this s3 client. The source code has "graceful-fs": "~4.1.4",, but the package.json at https://registry.npmjs.org/s3/-/s3-4.4.0.tgz has "graceful-fs": "~3.0.5",

@SyedSaimAliZaidi
Copy link

you need to update graceful-fs package of s3 to updated version it will work then. i had the same issue.

i have updated the package but the issue is still there.
[nodemon] starting node index.js
fs.js:35
} = primordials;
^

ReferenceError: primordials is not defined
at fs.js:35:5
at req_ (C:\Users\Venom\Desktop\test\node_modules\natives\index.js:143:24)
at Object.req [as require] (C:\Users\Venom\Desktop\test\node_modules\natives\index.js:55:10)
at Object. (C:\Users\Venom\Desktop\test\node_modules\s3\node_modules\graceful-fs\fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
[nodemon] app crashed - waiting for file changes before starting...

@brainlessboy
Copy link

same her, node 12.18.0 breaks, i found this which solves the problem by forcing the graceful-fs to 4.x using npm-shrinkwrap.json, but requires to manualy regenerate that file every time npm i is executed, if not it breaks again. so how do you update the graceful-fs in the s3 package the right way?

@RajaBellebon
Copy link

Hello @brainlessboy ,

You can use the resolutions field in package.json and force the version there.

Something like this

"resolutions": {
.....
graceful-fs": "4.x.x"
}

@brainlessboy
Copy link

@RajaBellebon many thanks!

@mayurtikundi12
Copy link

n production and I can't change manually the
you can check this module , just change the module this is the updated one https://www.npmjs.com/package/s3abstraction

@andersryanc
Copy link

@RajaBellebon your solution using resolutions doesn't seem to work for me. Are you using yarn? According to this StackOverflow post resolutions isn't supported by node directly ... If you are using Node, which version? I'm currently on 12.

@BlackSonic thanks for the suggestion, I was able to get things working on my end using the @auth0/s3 fork. Seems like the fact that they updated graceful-fs in there did the trick!

Is there any timeline to update this package properly?

@ncnipunchawla
Copy link

I am using https://www.npmjs.com/package/s3-node for Node 14

npm install s3-node

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants