cozy / cozy-data-system

Deprecated - Data Layer for Cozy V2 Platform
https://cozy.io
GNU Affero General Public License v3.0
24 stars 21 forks source link

Error: Can't set headers after they are sent #198

Closed clochix closed 8 years ago

clochix commented 8 years ago

Seen in the logs (no more informations on the context):

[Fri, 22 Jan 2016 14:08:45 GMT] - GET /replication/?_nonce=1453471724944 - 403 - 7.263 ms -  242
[Fri, 22 Jan 2016 14:08:49 GMT] - POST /request/folder/byfullpath/ - 401 - 1.540 ms -  44
[Fri, 22 Jan 2016 14:08:49 GMT] - GET /replication/_changes?descending=true&limit=1 - 403 - 6.746 ms -  14
ute.js:107:5)
    at /usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/router/index.js:213:24
    at param (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/router/index.js:303:14)
    at param (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/router/index.js:319:14)
    at param (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/router/index.js:319:14)
[2016-01-22 14:08:20:877] error - replication | {}
[2016-01-22 14:08:20:877] error - replication | {}

http.js:690
    throw new Error('Can\'t set headers after they are sent.');
          ^
Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (http.js:690:11)
    at ServerResponse.res.set.res.header (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/response.js:565:10)
    at ServerResponse.res.send (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/response.js:134:12)
    at ServerResponse.res.json (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/response.js:212:15)
    at ServerResponse.res.send (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/response.js:122:21)
    at IncomingMessage.<anonymous> (/usr/local/cozy/apps/data-system/build/server/controllers/replication.js:143:19)
    at IncomingMessage.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (_stream_readable.js:765:14)
    at IncomingMessage.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:427:10)
[2016-01-22 14:08:49:163] error - app:error | Application is not authenticated
[2016-01-22 14:08:49:170] error - app:error | Error: Application is not authenticated
    at /usr/local/cozy/apps/data-system/build/server/helpers/utils.js:29:13
    at module.exports.checkDocType (/usr/local/cozy/apps/data-system/build/server/lib/token.js:53:14)
    at module.exports.checkPermissions (/usr/local/cozy/apps/data-system/build/server/helpers/utils.js:27:10)
    at Object.module.exports.checkPermissionsByType [as handle] (/usr/local/cozy/apps/data-system/build/server/middlewares/utils.js:65:10)
    at next_layer (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/router/route.js:103:13)
    at Route.dispatch (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/router/route.js:107:5)
    at /usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/router/index.js:213:24
    at param (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/router/index.js:303:14)
    at param (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/router/index.js:319:14)
    at param (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/router/index.js:319:14)
[2016-01-22 14:08:49:258] error - replication | {}
[2016-01-22 14:08:49:259] error - replication | {}

http.js:690
    throw new Error('Can\'t set headers after they are sent.');
          ^
Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (http.js:690:11)
    at ServerResponse.res.set.res.header (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/response.js:565:10)
    at ServerResponse.res.send (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/response.js:134:12)
    at ServerResponse.res.json (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/response.js:212:15)
    at ServerResponse.res.send (/usr/local/cozy/apps/data-system/node_modules/americano/node_modules/express/lib/response.js:122:21)
    at IncomingMessage.<anonymous> (/usr/local/cozy/apps/data-system/build/server/controllers/replication.js:143:19)
    at IncomingMessage.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (_stream_readable.js:765:14)
    at IncomingMessage.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:427:10)
nono commented 8 years ago

I think https://github.com/cozy/cozy-data-system/commit/92840602b47e2672ff26ef4ed65d11be91329f5c can have fixed this error.