-
Notifications
You must be signed in to change notification settings - Fork 217
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
buttons not working in mounted mode #23
Comments
Check if 0.3.2 version helps with your issue |
still no luck; Failed to load resource: the server responded with a status of 403 (Forbidden) |
Same issue here, none of the buttons work when we run: $(npm bin)/agendash --db=mongodb://localhost/databasename --collection=agendaJobs --port=1081
It shows jobs correctly, though. To test, just clone our repo: git clone https://github.com/Trustroots/trustroots.git
cd trustroots
npm install
npm start When clicking "Requeue selected" (or anything else), I get:
And at terminal: /PROJCET/node_modules/agenda/node_modules/mongodb/lib/utils.js:98
process.nextTick(function() { throw err; });
^
Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:346:11)
at ServerResponse.header (/PROJCET/node_modules/express/lib/response.js:719:10)
at ServerResponse.send (/PROJCET/node_modules/express/lib/response.js:164:12)
at ServerResponse.json (/PROJCET/node_modules/express/lib/response.js:250:15)
at /PROJCET/node_modules/agendash/lib/middlewares/express.js:28:18
at /PROJCET/node_modules/agendash/lib/agendash.js:69:9
at /PROJCET/node_modules/agenda/lib/agenda.js:320:7
at /PROJCET/node_modules/agenda/node_modules/mongodb/lib/collection.js:1159:32
at handleCallback (/PROJCET/node_modules/agenda/node_modules/mongodb/lib/utils.js:96:12)
at /PROJCET/node_modules/agenda/node_modules/mongodb/lib/collection.js:1191:20
|
0.4.0 here Failed to load resource: the server responded with a status of 403 (Forbidden) /api/jobs/requeue The thing is that i use agendash as mounted. could be related? |
What version of express are you mounting onto? On Oct 28, 2016 5:21 AM, "Hüseyin Uslu" notifications@github.com wrote:
|
latest express 4 "express": "^4.14.0", |
Does your express app respond to other endpoints? If your express app already has routes like Where you mount Agendash onto Express like this: I have a PR for an update to the readme: #43 |
It's already mounted so for me on a unique path. |
The error message says /api/jobs/requeue is forbidden, but you have it On Oct 29, 2016 5:55 AM, "Hüseyin Uslu" notifications@github.com wrote:
|
Are you by chance using any CSRF middleware, like var csrf = require('csurf');
var csrfProtection = csrf({ cookie: true });
// Your app
var myApp = express();
app.use(csrfProtection);
// Agendash app
var agendashApp = Agendash(agenda);
agendashApp.use(csrfProtection);
app.use('/agendash', agendashApp); |
@yangchristian yes i was actually using csurf - how to disable it for agendash? |
Not sure how you're using var csrfFreeRoutes = [
new RegExp('^/agendash/api/'), // Whatever your mounted path is
// new RegExp('^/otherRoutes')
];
function isCsrfFree(path) {
return !!_.find(csrfFreeRoutes, function(regex) {
return !!regex.test(path);
});
}
app.use( function(req, res, next) {
if (isCsrfFree(req.path)) {
csrf({ cookie: true })(req,res,next);
} else {
next();
}
}); |
This is a stale issue. Such bug do not exist (as far as I can see) in the latest Agendash v2 |
i have mounted agendash to my own application -- it can render stuff all good but i can't reschedule jobs using them as the buttons are not working.
The text was updated successfully, but these errors were encountered: