After updating to Meteor 1.8.1 I'm having problems with my file upload. I'm using version 1.10.2 according to my versions file.
It happens in the FilesCollection constructor on the server inside the onBeforeUpload:
The this.userId and this.user() are both null even though I'm logged in as a user.
In the logs I also get this error:
W20190404-10:25:41.952(2)? (STDERR) [FilesCollection] [Upload] [HTTP] Exception: TypeError: Cannot read property 'profile' of undefined
W20190404-10:25:41.953(2)? (STDERR) at Object.onBeforeUpload (imports/api/files/server/files_server.js:108:11)
W20190404-10:25:41.953(2)? (STDERR) at FilesCollection._prepareUpload (packages/ostrio:files/server.js:903:51)
W20190404-10:25:41.953(2)? (STDERR) at bound (packages/ostrio:files/server.js:568:34)
W20190404-10:25:41.953(2)? (STDERR) at Meteor.bindEnvironment.callback (packages/ostrio:files/server.js:21:50)
W20190404-10:25:41.953(2)? (STDERR) at runWithEnvironment (packages/meteor.js:1286:24)
W20190404-10:25:41.956(2)? (STDERR) [object Object]
W20190404-10:25:41.957(2)? (STDERR) at handleError (packages/ostrio:files/server.js:441:21)
W20190404-10:25:41.957(2)? (STDERR) at bound (packages/ostrio:files/server.js:602:15)
W20190404-10:25:41.957(2)? (STDERR) at Meteor.bindEnvironment.callback (packages/ostrio:files/server.js:21:50)
W20190404-10:25:41.957(2)? (STDERR) at runWithEnvironment (packages/meteor.js:1286:24)
I can confirm that after updating to Meteor 1.8.1. this.userId and this.user() is both null (when logged in) in the protected method.
Same. Had to revert all current projects to Meteor 1.8.0.2
same
this.userId on server side is always null
From what I see by comparing two Meteor servers running 1.8.0.2 and 1.8.1, Meteor has changed the type of its Meteor.server.sessions object to a javascript map.
I suppose this could explain why the x_mtok session cookie, which is correctly transmitted to the server, can no more be used to retrieve userId with the syntax used here, which is :
Meteor.server.sessions[httpReq.headers['x-mtok']]
and should rather be something like :
Meteor.server.sessions.get(httpReq.headers['x-mtok'])
What do you people think ?
[EDIT] : replaced keys with get in the above code.
fix is available at https://github.com/VeliovGroup/Meteor-Files/pull/683
Hi @all I am here fo support with issues and PR and I am currently reproducing this issue with Meteor 1.8.1 and ostrio:[email protected] but I can't reproduce it neither in onBeforeUpload nor in protected.
Is there something I am missing here for the repro? Does this maybe occur only on a specific upload config like using HTTP instead of DDP or so?
@menelike I already tested your PR #683 and it seems not to break the default setup. I just want to make sure we are fine with everything before merging.
Edit: I can reproduce this for protected (just had a typo there) but still ca't seem to reproduce this in onBeforeUpload.
@jankapunkt, don't want to be pushy on this, but would it be possible to have an idea of when this could be merged? Trying to avoid the local package route...
@hluz I am ready to merge immediately when the requested changes are implemented. @menelike can you spare some time for these minor adjustments?
@jankapunkt sorry for the delay, I just updated #683.
Wow, that was fast :open_mouth: just merged it right now. @dr-dimitru are you free in time to publish a new version on atmosphere?
Most helpful comment
Wow, that was fast :open_mouth: just merged it right now. @dr-dimitru are you free in time to publish a new version on atmosphere?