Azure-Samples / openai-apim-lb

Smart load balancing for OpenAI endpoints and Azure API Management
MIT License
70 stars 26 forks source link

Type cast error because of "remainingBackends" #27

Open hlee118 opened 4 months ago

hlee118 commented 4 months ago

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

After I applying this policy to APIM it cause errors when it try to loadbalance to other endpoints. https://github.com/Azure-Samples/openai-apim-lb/blob/main/apim-policy.xml

Any log messages given by the failure

[{"elapsed":313,"source":"retry","reason":"ExpressionValueEvaluationFailure","message":"Expression evaluation failed. Unable to cast object of type 'System.Int32' to type 'System.String'.","scope":"operation","section":"backend"}]

Expected/desired behavior

There seems to be an issue with https://github.com/Azure-Samples/openai-apim-lb/pull/26. It occured type cast error because of "remainingBackends".

OS and Version?

Ubuntu 22.04

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

jgbradley1 commented 3 months ago

I am also experiencing this type cast issue

jgbradley1 commented 3 months ago

I tested the changes proposed in this PR and the errors went away for me. Hope that PR gets merged soon.

vandriot commented 2 days ago

Hello,

This is the same issue as in #29 I proposed another solution in the comment.

But the fix from #18 is working as well 🙂