-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Error: "Cannot switch to old mode now." #25
Comments
Multer 0.1.0 just released with busboy 0.2.6. Can you check with it? |
Nope, I've updated to v0.1.0 and I still get the same issue. Also updated to the latest express v4.3.2, etc. |
Can you paste the stack trace? I am suspecting something in Busboy. |
Sounds stupid, but there is no stack trace, I just get the error in my ExpressJS error handler with the error object:
|
Sorry @hacksparrow but I think I'm going to have to switch to using formidable for the time being as I cannot get this working at all... I'm really not sure what the hell happened though, it was working. Could it be due to the fact that I'm also using the Socket.IO library? |
Just to add to my last comment, I don't believe it's Socket.IO related, I stripped it out of my project entirely and the issue still persisted. Here's a full list of my dependencies, in case it might help in some way or other:
'use strict'
# Module dependencies.
express = require 'express'
http = require 'http'
sockets = require 'socket.io'
bodyParser = require 'body-parser'
multer = require 'multer'
morgan = require 'morgan'
compress = require 'compression'
cors = require 'cors'
passport = require 'passport'
winston = require 'winston'
error = require './middleware/errorHandling'
module.exports = () ->
app = express()
server = http.createServer(app)
io = sockets.listen(server)
app.set 'port', process.env.PORT or 3000
winstonStream =
write: (message, encoding) ->
winston.info message
app.use morgan stream: winstonStream
app.use compress()
app.use bodyParser()
app.use multer()
app.use cors()
# origin: true
# methods: ['GET', 'PUT', 'POST', 'DELETE']
# credentials: true
# maxAge: 3600
# Add the passport authentication middleware
app.use passport.initialize()
# Ensure that all routes are authenticated, except the route
# that gets the user count for a given site
authentication = passport.authenticate 'basic', session: false
app.use (req, res, next) ->
if (req.url.indexOf('/sites/') is 0 and
req.url.indexOf('/userCount', req.url.length - '/userCount'.length) isnt -1) or
req.url.indexOf('/twitter/userTimeline') is 0
next()
else
authentication(req, res, next)
# Configure the routes
require('./routes.js')(app)
# Configure the web socket listeners
require('./web_sockets')(io)
app.use error.handle404
app.use error.logErrors
app.use error.apiErrors
winston.info "Express server listening on port: #{app.get('port')}"
server.listen app.get('port') |
@hacksparrow BINGO! I've figured it out... It seems to be related to my Changing: app.use morgan stream: winstonStream
app.use compress()
app.use bodyParser()
app.use multer()
app.use cors() to: app.use morgan stream: winstonStream
app.use cors()
app.use compress()
app.use bodyParser()
app.use multer() (note the ordering!) fixes the issue. |
Glad you got it working! |
I'm using node.js version v0.10.28, ExpressJS v4.3.0 and Multer v0.0.7
When I send any files to a route which accepts multipart form data I get the error above. It was working perfectly fine, I'm not sure what's changed. 😕
The text was updated successfully, but these errors were encountered: