Meteor-Files: [SOLVED] "base64 is not a function" since updated to 1.7.10
TL:DR; update node to version 4.7.3 or higher ➡️ SOLVED
Hello all,
I got an issue when uploading in prod (this works in dev strangely). I catch the error from the call back from the insert on end with a nice Error during upload: Error: Internal server error [500] delivered to the client in the error param.
So I looked at the server log and here is what I get:
Exception while invoking method '_FilesCollectionWrite_images' TypeError: base64 is not a function
at Function.from (native)
at Function.from (native)
at [object Object].FilesCollection._methods.(anonymous function) (/home/gui/bookmeonline/programs/server/packages/ostrio_files.js:1385:35)
at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1737:12)
at packages/ddp-server/livedata_server.js:719:19
at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
at packages/ddp-server/livedata_server.js:717:40
at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
at packages/ddp-server/livedata_server.js:715:46
at [object Object]._.extend.protocol_handlers.method (packages/ddp-server/livedata_server.js:689:23)
It was working a couple days ago before my latest meteor update
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 22 (10 by maintainers)
Commits related to this issue
- Buffer.from pollyfill - See #355 - `Buffer.from` has no support of `base64` in some versions of node.js, while `Buffer.from` suggested replacement for deprecated `new Buffer()` constructor — committed to veliovgroup/Meteor-Files by dr-dimitru 7 years ago
- v1.7.11 - Fix #355 - `Buffer.from` has no support of `base64` in some versions of node.js, while `Buffer.from` suggested replacement for deprecated `new Buffer()` constructor - Other minor fixes — committed to veliovgroup/Meteor-Files by dr-dimitru 7 years ago
Ok with node 4.7.3 it works for me ! Thx a lot guys
Exactly, this error pops-up only on production. I just tried with
meteor --productionand it works fine.I will try to update node to 4.7.3
@guidouil @marcchapeau
I’m glad you have fixed this issue. That was a good reason to update node.js to newer and recommended version for Meteor.
Please, support this project by:
Meanwhile I found the roots of the issue. Since node
v5.*new Buffer()constructor is deprecated andBuffer.frommethod must be used instead. So we’ve added pollyfill to check ifBuffer.fromis supported, so folks can run meteor on newer node.js.Weird thing is somewhere between node
v4.5.*andv4.7.*Buffer.fromis implemented partially, withoutbase64support.Oh excuse me ! I’am a liar 😃 I change the node version to 4.7.3 but start my server with the absolute path of node 4.4.7. Sorry, just give me a second.
And on my side without the debug it works again… So I guess it’s thanks to the node update to 4.7.3 and I did not detect it before because I did not rebuild my meteor app but just stopped it and restarted. @marcchapeau can you try to update your node to 4.7.3 to see if it does fix the issue ? (I used nvm to choose exact version)
@dr-dimitru yes only in production after building with node 4.4.x it seems…