400 BAD REQUEST RENDERER_EXCEPTION Cannot read property

Hi guys…
I’m in trouble trying to call a request using VERSION 3 of a evalscript in a multipart-formdata POST

Bellow, follow my inputs and the response from Service. Could you help me with this issue?

request:
{“input”:{“bounds”:{“bbox”:[-53.4124684384803,-19.0388663330172,-53.4122684384803,-19.0386663330172]},“data”:[{“type”:“S2L2A”,“dataFilter”:{“timeRange”:{“from”:“2018-11-01T00:00:00Z”,“to”:“2018-11-28T00:00:00Z”}}}]},“output”:{“width”:10,“height”:10,“responses”:[{“identifier”:“idx0”,“format”:{“type”:“image/tiff”}},{“identifier”:“idx1”,“format”:{“type”:“image/tiff”}},{“identifier”:“idx2”,“format”:{“type”:“image/tiff”}},{“identifier”:“idx3”,“format”:{“type”:“image/tiff”}},{“identifier”:“idx4”,“format”:{“type”:“image/tiff”}},{“identifier”:“idx5”,“format”:{“type”:“image/tiff”}},{“identifier”:“idx6”,“format”:{“type”:“image/tiff”}},{“identifier”:“idx7”,“format”:{“type”:“image/tiff”}},{“identifier”:“userdata”,“format”:{“type”:“application/json”}}]}}

evalscript:
//VERSION=3
function setup() {return { input: [{ bands: [“B02”, “B03”, “B04”, “B08”], units: “DN” }],
output: [
{ id: “idx0”, bands: 4, sampleType: SampleType.UINT16 },
{ id: “idx1”, bands: 4, sampleType: SampleType.UINT16 },
{ id: “idx2”, bands: 4, sampleType: SampleType.UINT16 },
{ id: “idx3”, bands: 4, sampleType: SampleType.UINT16 },
{ id: “idx4”, bands: 4, sampleType: SampleType.UINT16 },
{ id: “idx5”, bands: 4, sampleType: SampleType.UINT16 },
{ id: “idx6”, bands: 4, sampleType: SampleType.UINT16 },
{ id: “idx7”, bands: 4, sampleType: SampleType.UINT16 }],
mosaicking: Mosaicking.ORBIT } }
function updateOutputMetadata(scenes, inputMetadata, outputMetadata) { outputMetadata.userData = { “metadata”: JSON.stringify(scenes) } }
function evaluatePixel (sample) {return {
idx0: [sample[0].B02, sample[0].B03, sample[0].B04, sample[0].B08],
idx1: [sample[1].B02, sample[1].B03, sample[1].B04, sample[1].B08],
idx2: [sample[2].B02, sample[2].B03, sample[2].B04, sample[2].B08],
idx3: [sample[3].B02, sample[3].B03, sample[3].B04, sample[3].B08],
idx4: [sample[4].B02, sample[4].B03, sample[4].B04, sample[4].B08],
idx5: [sample[5].B02, sample[5].B03, sample[5].B04, sample[5].B08],
idx6: [sample[6].B02, sample[6].B03, sample[6].B04, sample[6].B08],
idx7: [sample[7].B02, sample[7].B03, sample[7].B04, sample[7].B08] } }

response:
“error”: {

    "status": 400,

    "reason": "Bad Request",

    "message": "Failed to evaluate script!\nevalscript.js:24: TypeError: Cannot read property 'B02' of undefined\nidx6: [sample[6].B02, sample[6].B03, sample[6].B04, sample[6].B08],\n                ^\nTypeError: Cannot read property 'B02' of undefined\n    at evaluatePixel (evalscript.js:24:17)\n    at executeForMultipleScenes (<anonymous>:1004:14)\n",

    "code": "RENDERER_EXCEPTION"

}

Hi @wendel.souto,

it seems that the length of sample in your case is only 6 not 8 and that is why sample[6] and sample[7] can not be processed. To make your request work, simply remove outputs idx6 and idx7 from your request and from the evalscript.

I see that our catalog service returns 8 distinct dates for your bbox and dates, so I think there might be an issue on our side. We will check, thank you for reporting!

Thanks @avrecko!

Actually, our code is the same to process different dates, and only some of them are returning ERROR 400. Specific dates btw…

I would like to know if there is some irregularity in your side and if its fixable.
If you can respond me this week, I’ll be glad.

Thanks so much for your help and best regards.

Hi @wendel.souto,

I am confirming that there is an issue on our side resulting in the catalog API returning too many scenes. We are looking into it, it is fixable but we can not say exactly when the fix will be available. We will post when we know more.

Requesting images works correctly though. So one way to work around the issue would be to make a separate request for each date.

Hi @wendel.souto,
this has been fixed. If you search with your bbox and dates, you should get 6 distinct dates.

@avrecko Thank you very much
We are going to check again and keep with our development

Best regards