Comments (8)
Multer 0.1.0 just released with busboy 0.2.6. Can you check with it?
from multer.
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.
from multer.
Can you paste the stack trace? I am suspecting something in Busboy.
from multer.
Sounds stupid, but there is no stack trace, I just get the error in my ExpressJS error handler with the error object:
error: [Error: Cannot switch to old mode now.]
error: An error occured when user sent the following request:
URL: POST http://localhost/static/images
query: {}
body: {}
Error: [Error: Cannot switch to old mode now.]
from multer.
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?
from multer.
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:
"dependencies": {
"async": "~0.9.0",
"aws-sdk": "~2.0.0-rc.19",
"body-parser": "^1.3.0",
"compression": "^1.0.3",
"cors": "~2.3.1",
"express": "~4.4.1",
"gm": "~1.16.0",
"hiredis": "^0.1.17",
"lodash": "~2.4.1",
"mongoose": "~3.8.12",
"morgan": "^1.1.1",
"multer": "0.1.0",
"nodemailer": "~0.6.5",
"passport": "^0.2.0",
"passport-http": "^0.2.2",
"password-hash": "^1.2.2",
"redis": "^0.10.3",
"socket.io": "^1.0.4",
"twit": "~1.1.15",
"validator": "~3.13.0",
"winston": "~0.7.3",
"winston-loggly": "^1.0.1"
},
'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')
from multer.
@hacksparrow BINGO! I've figured it out...
It seems to be related to my cors
library.
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.
from multer.
Glad you got it working!
from multer.
Related Issues (20)
- Custom storage engine not working
- MulterError: Unexpected field when trying to use different storage configuration HOT 1
- Update Docs: Error: read ECONNRESET thrown during test using supertest, mocha but works fine while using postman. HOT 1
- Why does Multer does not release memory? HOT 1
- `preservePath` option not respected HOT 2
- This module only works with node 14 or LOWER HOT 40
- file.size undefined with multiple files HOT 2
- Request not finish when recieve an error HOT 11
- File upload middleware does not work when I chain it with other middlewares. I get req.file = undefined HOT 3
- bug: transfer-encoding HOT 3
- File type shows correct on the frontend but it changes to application/octet-stream on the backend HOT 1
- CVE-2022-24434: DoS affecting dicer (sub-dependency) HOT 3
- Requests made through pinia display 'MulterError: Unexpected field at wrappedFileFilter' HOT 2
- Publish version 1.4.5 HOT 1
- last filename is missing from `req.files` while use of 'fileds' middleware.
- Error: Route.post() requires a callback function but got a [object Object]
- multer fields array returned only first file HOT 4
- Folder cannot be deleted HOT 1
- Upload multiple files with multer? HOT 2
- I just can't figured whats wrong why my codes below. I try to upload multiple files.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from multer.