PayloadTooLargeError => sonar handles ts/js/html fine but fails at scss

hello there.

we run sonarcloud on gitlab ci against our frontend applications (ts/js/html/scss). ts,js and html it analyzes flawlessly, but it fails at scss files giving us these errors:

INFO: Sensor SonarCSS Rules [cssfamily]
INFO: 337 source files to be analyzed
ERROR: { PayloadTooLargeError: request entity too large
ERROR:     at readStream (/builds/***/.scannerwork/css-bundle/node_modules/raw-body/index.js:155:17)
ERROR:     at getRawBody (/builds/***/.scannerwork/css-bundle/node_modules/raw-body/index.js:108:12)
ERROR:     at read (/builds/***/.scannerwork/css-bundle/node_modules/body-parser/lib/read.js:77:3)
ERROR:     at jsonParser (/builds/***/.scannerwork/css-bundle/node_modules/body-parser/lib/types/json.js:135:5)
ERROR:     at Layer.handle [as handle_request] (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/layer.js:95:5)
ERROR:     at trim_prefix (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:317:13)
ERROR:     at /builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:284:7
ERROR:     at Function.process_params (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:335:12)
ERROR:     at next (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:275:10)
ERROR:     at expressInit (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/middleware/init.js:40:5)
ERROR:   message: 'request entity too large',
ERROR:   expected: 221079,
ERROR:   length: 221079,
ERROR:   limit: 102400,
ERROR:   type: 'entity.too.large' }
ERROR: { PayloadTooLargeError: request entity too large
ERROR:     at readStream (/builds/***/.scannerwork/css-bundle/node_modules/raw-body/index.js:155:17)
ERROR:     at getRawBody (/builds/***/.scannerwork/css-bundle/node_modules/raw-body/index.js:108:12)
ERROR:     at read (/builds/***/.scannerwork/css-bundle/node_modules/body-parser/lib/read.js:77:3)
ERROR:     at jsonParser (/builds/***/.scannerwork/css-bundle/node_modules/body-parser/lib/types/json.js:135:5)
ERROR:     at Layer.handle [as handle_request] (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/layer.js:95:5)
ERROR:     at trim_prefix (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:317:13)
ERROR:     at /builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:284:7
ERROR:     at Function.process_params (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:335:12)
ERROR:     at next (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:275:10)
ERROR:     at expressInit (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/middleware/init.js:40:5)
ERROR:   message: 'request entity too large',
ERROR:   expected: 224611,
ERROR:   length: 224611,
ERROR:   limit: 102400,
ERROR:   type: 'entity.too.large' }
ERROR: { PayloadTooLargeError: request entity too large
ERROR:     at readStream (/builds/***/.scannerwork/css-bundle/node_modules/raw-body/index.js:155:17)
ERROR:     at getRawBody (/builds/***/.scannerwork/css-bundle/node_modules/raw-body/index.js:108:12)
ERROR:     at read (/builds/***/.scannerwork/css-bundle/node_modules/body-parser/lib/read.js:77:3)
ERROR:     at jsonParser (/builds/***/.scannerwork/css-bundle/node_modules/body-parser/lib/types/json.js:135:5)
ERROR:     at Layer.handle [as handle_request] (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/layer.js:95:5)
ERROR:     at trim_prefix (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:317:13)
ERROR:     at /builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:284:7
ERROR:     at Function.process_params (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:335:12)
ERROR:     at next (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:275:10)
ERROR:     at expressInit (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/middleware/init.js:40:5)
ERROR:   message: 'request entity too large',
ERROR:   expected: 105629,
ERROR:   length: 105629,
ERROR:   limit: 102400,
ERROR:   type: 'entity.too.large' }
ERROR: { PayloadTooLargeError: request entity too large
ERROR:     at readStream (/builds/***/.scannerwork/css-bundle/node_modules/raw-body/index.js:155:17)
ERROR:     at getRawBody (/builds/***/.scannerwork/css-bundle/node_modules/raw-body/index.js:108:12)
ERROR:     at read (/builds/***/.scannerwork/css-bundle/node_modules/body-parser/lib/read.js:77:3)
ERROR:     at jsonParser (/builds/***/.scannerwork/css-bundle/node_modules/body-parser/lib/types/json.js:135:5)
ERROR:     at Layer.handle [as handle_request] (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/layer.js:95:5)
ERROR:     at trim_prefix (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:317:13)
ERROR:     at /builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:284:7
ERROR:     at Function.process_params (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:335:12)
ERROR:     at next (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:275:10)
ERROR:     at expressInit (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/middleware/init.js:40:5)
ERROR:   message: 'request entity too large',
ERROR:   expected: 277697,
ERROR:   length: 277697,
ERROR:   limit: 102400,
ERROR:   type: 'entity.too.large' }
ERROR: { PayloadTooLargeError: request entity too large
ERROR:     at readStream (/builds/***/.scannerwork/css-bundle/node_modules/raw-body/index.js:155:17)
ERROR:     at getRawBody (/builds/***/.scannerwork/css-bundle/node_modules/raw-body/index.js:108:12)
ERROR:     at read (/builds/***/.scannerwork/css-bundle/node_modules/body-parser/lib/read.js:77:3)
ERROR:     at jsonParser (/builds/***/.scannerwork/css-bundle/node_modules/body-parser/lib/types/json.js:135:5)
ERROR:     at Layer.handle [as handle_request] (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/layer.js:95:5)
ERROR:     at trim_prefix (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:317:13)
ERROR:     at /builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:284:7
ERROR:     at Function.process_params (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:335:12)
ERROR:     at next (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:275:10)
ERROR:     at expressInit (/builds/***/.scannerwork/css-bundle/node_modules/express/lib/middleware/init.js:40:5)
ERROR:   message: 'request entity too large',
ERROR:   expected: 159201,
ERROR:   length: 159201,
ERROR:   limit: 102400,
ERROR:   type: 'entity.too.large' }
INFO: 337/337 source files have been analyzed
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=6331ms

wasn’t able to find anything recent on google and in here and got quite stuck with the problem. anyone got a smart idea i overlooked maybe?

thanks!

Hi Mathias,
Were you ever able to resolve this issue? I am also seeing this error.

Thanks,
Allan

Hi!

I am running into this issue as well - we are using the Azure DevOps marketplace plugin. Similar behavior, it is a project containing html, js, and scss. Everything works fine until it analyzes the scss files.

Thanks!

Jesse

Hey all!

This issue is most likely sonar-css #251.

When sending data to Node process we are sending full file content in SonarLint context or when file has not utf-8 encoding

You can check in the scanner logs to see if the file in question is not UTF-8, to verify this is the issue you’re facing.

It should be fixed eventually, but in the meantime you can ignore the errors, exclude the files from analysis, or make sure the files are UTF8 encoded.

Colin

1 Like

HI. Looks like got the same issue

INFO: 2 source files to be analyzed

(https://*******/141428#L86)ERROR: PayloadTooLargeError: request entity too large

(https://*******/141428#L87)ERROR: at readStream (/builds/ui-team/qa/dashboard-integration-tests/.scannerwork/css-bundle/node_modules/raw-body/index.js:155:17)

(https://*******/141428#L88)ERROR: at getRawBody (/builds/ui-team/qa/dashboard-integration-tests/.scannerwork/css-bundle/node_modules/raw-body/index.js:108:12)

(https://*******/141428#L89)ERROR: at read (/builds/ui-team/qa/dashboard-integration-tests/.scannerwork/css-bundle/node_modules/body-parser/lib/read.js:77:3)

(https://*******/141428#L90)ERROR: at jsonParser (/builds/ui-team/qa/dashboard-integration-tests/.scannerwork/css-bundle/node_modules/body-parser/lib/types/json.js:135:5)

(https://*******/141428#L91)ERROR: at Layer.handle [as handle_request] (/builds/ui-team/qa/dashboard-integration-tests/.scannerwork/css-bundle/node_modules/express/lib/router/layer.js:95:5)

(https://*******/141428#L92)ERROR: at trim_prefix (/builds/ui-team/qa/dashboard-integration-tests/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:317:13)

(https://*******/141428#L93)ERROR: at /builds/ui-team/qa/dashboard-integration-tests/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:284:7

(https://*******/141428#L94)ERROR: at Function.process_params (/builds/ui-team/qa/dashboard-integration-tests/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:335:12)

(https://*******/141428#L95)ERROR: at next (/builds/ui-team/qa/dashboard-integration-tests/.scannerwork/css-bundle/node_modules/express/lib/router/index.js:275:10)

(https://*******/141428#L96)ERROR: at expressInit (/builds/ui-team/qa/dashboard-integration-tests/.scannerwork/css-bundle/node_modules/express/lib/middleware/init.js:40:5) {

(https://*******/141428#L97)ERROR: expected: 94372086,

(https://*******/141428#L98)ERROR: length: 94372086,

(https://*******/141428#L99)ERROR: limit: 52428800,

(https://*******/141428#L100)ERROR: type: ‘entity.too.large’

(https://*******/141428#L101)ERROR: }

(https://*******/141428#L102)ERROR: PayloadTooLargeError: request entity too large