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)
- Error in uploading a photo in javascript using a multer. HOT 2
- There is a way to effectively add a custom Error handler to multer? HOT 2
- (love) Just to tell you how great your software is HOT 1
- TypeError: Cannot read properties of undefined (reading 'length') when fieldNameSize is not set HOT 6
- Upgrade to the latest version of busboy to prevent potential DOS attack via Dicer HOT 1
- File upload got stuck while uploading large text files HOT 3
- Upload file use Multer with Multer-gridfs-storage in environment of bun is not working but when I use environment of nodejs then it's working? HOT 1
- req.file returning Undefined on frontend, but with Insomnia returns correctly HOT 4
- 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 39
- 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 2
- bug: transfer-encoding HOT 2
- 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 2
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.