One of my meteor package is using ostrio:files. After upgrading to latest ostrio:files and latest meteor. I got below issue, issue will not happen if I remove ostrio:files dependency from my package.
modules.js?hash=355b762…:22419 Uncaught ReferenceError: Buffer is not defined
at util.js (modules.js?hash=355b762…:22419)
at fileEvaluate (modules-runtime.js?hash=8587d18…:343)
at require (modules-runtime.js?hash=8587d18…:238)
at meteorInstall.node_modules.meteor-node-stubs.node_modules.readable-stream.lib._stream_readable.js (modules.js?hash=355b762…:18103)
at fileEvaluate (modules-runtime.js?hash=8587d18…:343)
at require (modules-runtime.js?hash=8587d18…:238)
at meteorInstall.node_modules.meteor-node-stubs.node_modules.readable-stream.readable.js (modules.js?hash=355b762…:18038)
at fileEvaluate (modules-runtime.js?hash=8587d18…:343)
at require (modules-runtime.js?hash=8587d18…:238)
at meteorInstall.node_modules.meteor-node-stubs.node_modules.stream-browserify.index.js (modules.js?hash=355b762…:17922)
What Meteor version and Meteor-Files version you're on?
BTW two of latest releases somehow broken (#420), have you tried to downgrade?
@haojia321 just found this - https://github.com/meteor/meteor/issues/8645#issuecomment-302253375
Hello @haojia321 ,
Have you fixed it?
Sorry for the delay @dr-dimitru , Yes this work around will work by add global.Buffer = global.Buffer || require("buffer").Buffer;
But my question is, will it be better to handle this in ostrio:files package itself?
But my question is, will it be better to handle this in ostrio:files package itself?
Sure update is coming.
@dr-dimitru as always, you rock!
@haojia321 have you already tried dynamic import()?
No, we are still in 1.4.4.3. Will update in here after we update to meteor 1.5.
Should we remove tag wont fix if we are planning to fix in package itself?
Should we remove tag wont fix if we are planning to fix in package itself?
But this behavior won't change anytime in the future, due to core changes in Meteor>=1.5
I'm going to reopen this. As we can't reproduce this error with our 3 demo apps, nor with our production app. Need more investigation.
@haojia321 is this still an issue?
Hi @dr-dimitru,
As we discussed above by adding global.Buffer = global.Buffer || require("buffer").Buffer;
Do you think it will be possible to put that code in your package since your package is using Buffer and Meteor no longer set Buffer to global variable? That way might help package user keeping their code clean?
It's not this package issue. We can't reproduce this error with our 3 demo apps, nor with our production app. Are you sure Buffer is not used anywhere in your app' code, NPM or Atmosphere packages?
Any idea how to check if Buffer is used by certain packages?
--
Best regards
Hao Jia
Cell phone: 641-455-9631
Send from my iPhone 7
On Jun 9, 2017, at 11:09, dr.dimitru notifications@github.com wrote:
It's not this package issue. We can't reproduce this error with our 3 demo apps, nor with our production app. Are you sure Buffer is not used anywhere in your app' code, NPN or Atmosphere packages?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
No idea, maybe better to ask here or search here one of the first widely used is OAuth.
Ok. Im closing this issue here.
If you will find which package caused it, left its name here
Hi there, I got this issue in one way if :
const Images = new FilesCollection({
collectionName: 'Images',
onBeforeUpload(file) {
},
onAfterUpload(file) {
///SERVER SIDE NO ISSUE WITH BUFFER
}
But if you use it with the eventListener :
Images.on('afterUpload'.... /// CLIENT SIDE
effectively you'll get the issue Buffer is not defined.
global.Buffer = global.Buffer || require("buffer").Buffer is a nice workaround.
Hello @Vandell63 ,
Thank you for this exploring.
Images.on('afterUpload')
Is Server only event as well as onBeforeUpload Server only hook.
I can not assume it as issue as it is not supposed to be used on the Client.
Most helpful comment
@dr-dimitru as always, you rock!