Error: Request failed with status code 500

Hi, I have been working on implementing scene classification API in javascript. There might be problems with the server configuration, a server overload, or an error in the application code that is running on the server.
I am getting this error- Error: Request failed with status code 500
at createError (C:\Users\node_modules@sentinel-hub\sentinelhub-js\node_modules\axios\lib\core\createError.js:16:15)
at settle (C:\Users\node_modules@sentinel-hub\sentinelhub-js\node_modules\axios\lib\core\settle.js:18:12)
at IncomingMessage.handleStreamEnd (C:\Users\node_modules@sentinel-hub\sentinelhub-js\node_modules\axios\lib\adapters\http.js:202:11)
at IncomingMessage.emit (node:events:524:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
config: {
adapter: [Function: httpAdapter],
transformRequest: { ‘0’: [Function: transformRequest] },
transformResponse: { ‘0’: [Function: transformResponse] },
timeout: 0,
xsrfCookieName: ‘XSRF-TOKEN’,
xsrfHeaderName: ‘X-XSRF-TOKEN’,
maxContentLength: -1,
validateStatus: [Function: validateStatus],

Please provide solution for this.
Thank You!

Hi @s.rajendra.vikhe ,

Would you mind providing us the complete request which returned an error in the curl format? From what I can see in our system, it seems that you are parsing application/json, text/plain, */* in Accept header which is unsupported.

This script I am using written in javascript-
const { S2L2ALayer,setAuthToken, ApiType, MimeTypes, CRS_EPSG4326, BBox } = require(‘@sentinel-hub/sentinelhub-js’);

const clientId = ‘****ab9d3’;
const clientSecret = ‘****l>9L’;

setAuthToken(clientId, clientSecret);

const evalscript = `
function RGBToColor (r, g, b,dataMask){
return [r/255, g/255, b/255,dataMask];

function setup() {
return {
input: [“SCL”,“dataMask”],
output: { bands: 4 }

function evaluatePixel(samples) {
const SCL=samples.SCL;
switch (SCL) {
// No Data (Missing data) - black
case 0: return RGBToColor (0, 0, 0,samples.dataMask);

// Saturated or defective pixel - red 
case 1: return RGBToColor (255, 0, 0,samples.dataMask);

// Topographic casted shadows ("Dark features/Shadows" for data before 2022-01-25) - very dark grey
case 2: return RGBToColor (47,  47,  47,samples.dataMask);
// Cloud shadows - dark brown
case 3: return RGBToColor (100, 50, 0,samples.dataMask);
// Vegetation - green
case 4: return RGBToColor (0, 160, 0,samples.dataMask);
// Not-vegetated - dark yellow
case 5: return RGBToColor (255, 230, 90,samples.dataMask);
// Water (dark and bright) - blue
case 6: return RGBToColor (0, 0, 255,samples.dataMask);

// Unclassified - dark grey
case 7: return RGBToColor (128, 128, 128,samples.dataMask);

// Cloud medium probability - grey
case 8: return RGBToColor (192, 192, 192,samples.dataMask);
// Cloud high probability - white
case 9: return RGBToColor (255, 255, 255,samples.dataMask);

// Thin cirrus - very bright blue
case 10: return RGBToColor (100, 200, 255,samples.dataMask);
// Snow or ice - very bright pink
case 11: return RGBToColor (255, 150, 255,samples.dataMask);

default : return RGBToColor (0, 0, 0,samples.dataMask);  


const layer = new S2L2ALayer({
evalscript: evalscript,

const getMapParams = {
bbox: new BBox(CRS_EPSG4326, 12.44693, 41.870072, 12.541001, 41.917096),
fromTime: new Date(‘2023-03-26T00:00:00Z’),
toTime: new Date(‘2023-04-26T23:59:59Z’),
width: 512,
height: 343.697,
format: MimeTypes.JPEG,

layer.getMap(getMapParams, ApiType.PROCESSING)
.then(response => {

const fs = require('fs');

.catch(error => {

Hi @s.rajendra.vikhe ,

I tested your Evalscript and request body and it seemed all right to me. The only difference is that you
inserted your client id and client secret to setAuthToken, which should be an access token instead.

To fetch a token, please take a look at the Authentication section of our documentation and follow the javascript example. After having an access token, please use it as shown below and try to make a request again:


For Agricultural crop monitoring in Sentinel 1 I am getting below error -
Uncaught Error Error: Request failed with status code 400
at createError (c:\Users\s.rajendra.vikhe\node_modules@sentinel-hub\sentinelhub-js\node_modules\axios\lib\core\createError.js:16:15)
at settle (c:\Users\s.rajendra.vikhe\node_modules@sentinel-hub\sentinelhub-js\node_modules\axios\lib\core\settle.js:18:12)
at handleStreamEnd (c:\Users\s.rajendra.vikhe\node_modules@sentinel-hub\sentinelhub-js\node_modules\axios\lib\adapters\http.js:202:11)
at emit (node:events:524:35)
at endReadableNT (internal/streams/readable:1359:12)
at processTicksAndRejections (node:internal/process/task_queues:82:21)

Hi @s.rajendra.vikhe ,

400 error generally means an error occurred from the user’s side, which is usually indicating there’s something wrong in your request.

Could you please provide your request in the curl fromat (you can do it by compiling your request using Requests Builder and copy the curl request from the Request Preview window)? This would allow us to reproduce the error and help you solve your issue in the fastest way.

Thank you!