-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When downloading a file, error: "Cannot return null or undefined from an endpoint" #135
Comments
Everything looks great there at first glance. This is a tested feature, so, if you're experiencing a potential bug, I'll either need reproduction steps or (even better) a sample repo demonstrating the issue. That should help me get to the bottom of it. Sorry that you're experiencing the issue. I hope we can get this resolved for you asap. Also, thanks for the compliment, and thanks for reporting this! |
Returning an empty object saved me from the same exception!! |
@mehar Thanks for the suggestion. The problem here is that it appears @andrewash is always returning something from that endpoint, except when they manually handled the response, in which case calling |
@kahmali Reproduction steps are quite simple
You will see the above mentioned exception Add a return {}; statement at the end and see everything works as expected |
Alright. I'll test that out asap. As you can see there is an automated test in place for this that is passing in local and CI tests: https://github.com/kahmali/meteor-restivus/blob/devel/test/api_tests.coffee#L229. Not sure how that's possible, but I'll look into as soon as I have a chance. Thanks for providing the repro steps @mehar! |
Oh, I see. It works, but it still throws the error on the console. Ahhh. That should be an easy fix. I'll look into that. Sorry for the misunderstanding. |
Thanks @kahmali , btw thanks for the awesome library!!! |
How to do this in restivus,, I wanna make a server for handling a file upload from my android native client. Below is the code that's implemented in node js that i get from tutorial in internet. How to do like this below in meteor js especially with this library restivus var fs = require('fs'); module.exports = function(app) { app.get('/',function(req,res){ }); app.get('/uploads/:file', function (req, res){ }); |
Same problem here (
The statusCode 200 goes through without problems at all. Detailed error message is:
Not sure if it's the same bug causing it. I've also tried it with returning a statusCode and an Object (similar to statusCode 200 object) but to no avail. |
Hi @a4xrbj1, I probably did it trying to enforce "best practices," but you're required to return a
I believe it's best practice to return an error message in the body in error responses, but to each their own. I'd personally suggest returning something like this (to follow the JSend response standard we use throughout Restivus, for consistent response format):
Hope that helps! |
Hi there, I get the same issue when uploading. I'm trying to use the multer npm package with restivus to add a file upload function to some restful api. The irony is that although restivus throws an error the file does get uploaded! I get this: If I add a return {} then the there's no error but then multer hangs. I've made a quick and dirty repo to demonstrate: https://github.com/LaughingBubba/uploads-meteor Thoughts? Cheers |
Hi @LaughingBubba, Sorry to you and everyone else for the delay on fixing this. I completely overlooked it. I just published v0.8.11 to address the issue outlined by @mehar above. Hopefully that fixes the hanging in multer for you. I didn't have time to write a new test, so I'm going to keep this issue open until you verify that it works for you. Thanks for reporting your issue, and sorry again to you and anyone else that's been waiting on this fix! |
No worries! Thanks for the update. I'll check now and let you know. |
Thank you for putting this awesome library together!
I've created a custom "get" endpoint for one of my collections. This endpoint responds by writing an (MP3) file in the response and sending it to the client. Only authenticated responses are accepted (the security trimming is why I'm using Restivus for this, instead of regular HTTP download).
It works, but generates an error in Meteor's server console:
I am calling this.done(), per the docs, so I'm not sure why the error occurs.
Anything I can do to eliminate the error message?
Thanks for your help,
Andrew
The text was updated successfully, but these errors were encountered: