Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting 500 error from cosmosdb "The index path corresponding to the specified order-by item is excluded." from find query. #10637

Open
daman-ltim opened this issue Aug 27, 2024 · 0 comments
Labels

Comments

@daman-ltim
Copy link

daman-ltim commented Aug 27, 2024

Describe the bug

Created a new app from loopback 4 cli and created a new DataSource, model, controller and repository.
Query used for the apis is this.dbTestRepository.find(filter).
After using the get api from that app facing below error.
GET localhosts:3000/db-tests
Current Output:
Error
Request GET /db-tests Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 95292a49-f12c-44bc-bc0b-95d5a2272e5b; Reason: (Message: {"Errors": ["The index path corresponding to the specified order-by item is excluded."]}

Expected Output:
Should return the data array output
[{
"_id": {
"$oid": "66cdadb18cd33676522f817f"
},
"name": "test",
"description": "test",
"tags": "test"
}]

Logs

Request GET /db-tests?filter=%7B%0A%20%20%22offset%22%3A%200%2C%0A%20%20%22limit%22%3A%20100%2C%0A%20%20%22skip%22%3A%200%2C%0A%20%20%22order%22%3A%20%22string%22%2C%0A%20%20%22where%22%3A%20%7B%0A%20%20%20%20%22additionalProp1%22%3A%20%7B%7D%0A%20%20%7D%2C%0A%20%20%22fields%22%3A%20%7B%0A%20%20%20%20%22id%22%3A%20true%2C%0A%20%20%20%20%22name%22%3A%20true%2C%0A%20%20%20%20%22description%22%3A%20true%2C%0A%20%20%20%20%22tags%22%3A%20true%0A%20%20%7D%0A%7D failed with status code 500. MongoError: Error=2, Details='Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 95292a49-f12c-44bc-bc0b-95d5a2272e5b; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 95292a49-f12c-44bc-bc0b-95d5a2272e5b; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: 95292a49-f12c-44bc-bc0b-95d5a2272e5b; Reason: (Message: {"Errors":["The index path corresponding to the specified order-by item is excluded."]}
ActivityId: 95292a49-f12c-44bc-bc0b-95d5a2272e5b, Request URI: /apps/a793b7f7-4246-4309-81ba-ad4af333120e/services/84dedc99-0a78-4662-abfd-e1db741fce01/partitions/7cfbe97d-6c88-4bb8-bd37-3c5dca28d326/replicas/133692072018076725p/, RequestStats: Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum, SDK: Windows/10.0.20348 cosmos-netstandard-sdk/3.18.0);););
    at MessageStream.messageHandler (C:\Users\10691096\code\pg\db-test\node_modules\mongodb\lib\cmap\connection.js:299:20)
    at MessageStream.emit (node:events:519:28)
    at processIncomingData (C:\Users\10691096\code\pg\db-test\node_modules\mongodb\lib\cmap\message_stream.js:144:12)
    at MessageStream._write (C:\Users\10691096\code\pg\db-test\node_modules\mongodb\lib\cmap\message_stream.js:42:5)
    at writeOrBuffer (node:internal/streams/writable:564:12)
    at _write (node:internal/streams/writable:493:10)
    at MessageStream.Writable.write (node:internal/streams/writable:502:10)
    at TLSSocket.ondata (node:internal/streams/readable:1007:22)
    at TLSSocket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at TLSSocket.Readable.push (node:internal/streams/readable:390:5)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23)
Request GET /db-tests?filter=%7B%0A%20%20%22offset%22%3A%200%2C%0A%20%20%22limit%22%3A%20100%2C%0A%20%20%22skip%22%3A%200%2C%0A%20%20%22order%22%3A%20%22string%22%2C%0A%20%20%22where%22%3A%20%7B%0A%20%20%20%20%22additionalProp1%22%3A%20%7B%7D%0A%20%20%7D%2C%0A%20%20%22fields%22%3A%20%7B%0A%20%20%20%20%22id%22%3A%20true%2C%0A%20%20%20%20%22name%22%3A%20true%2C%0A%20%20%20%20%22description%22%3A%20true%2C%0A%20%20%20%20%22tags%22%3A%20true%0A%20%20%7D%0A%7D failed with status code 500. MongoError: Error=2, Details='Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: f58ff6ef-94c7-4406-8b43-cbdaf9902e4f; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: f58ff6ef-94c7-4406-8b43-cbdaf9902e4f; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: f58ff6ef-94c7-4406-8b43-cbdaf9902e4f; Reason: (Message: {"Errors":["The index path corresponding to the specified order-by item is excluded."]}
ActivityId: f58ff6ef-94c7-4406-8b43-cbdaf9902e4f, Request URI: /apps/a793b7f7-4246-4309-81ba-ad4af333120e/services/84dedc99-0a78-4662-abfd-e1db741fce01/partitions/7cfbe97d-6c88-4bb8-bd37-3c5dca28d326/replicas/133692072072919984s/, RequestStats: Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum, SDK: Windows/10.0.20348 cosmos-netstandard-sdk/3.18.0);););
    at MessageStream.messageHandler (C:\Users\10691096\code\pg\db-test\node_modules\mongodb\lib\cmap\connection.js:299:20)
    at MessageStream.emit (node:events:519:28)
    at processIncomingData (C:\Users\10691096\code\pg\db-test\node_modules\mongodb\lib\cmap\message_stream.js:144:12)
    at MessageStream._write (C:\Users\10691096\code\pg\db-test\node_modules\mongodb\lib\cmap\message_stream.js:42:5)
    at writeOrBuffer (node:internal/streams/writable:564:12)
    at _write (node:internal/streams/writable:493:10)
    at MessageStream.Writable.write (node:internal/streams/writable:502:10)
    at TLSSocket.ondata (node:internal/streams/readable:1007:22)
    at TLSSocket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at TLSSocket.Readable.push (node:internal/streams/readable:390:5)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23)

Additional information

No response

Reproduction

https://github.com/daman-ltim/db-test

@daman-ltim daman-ltim added the bug label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant