Getting 400 response with already working code

we were using the same embedding API for a week it was working,no change in input,all of sudden we are getting 400 on the same API & input, we have also tried updating libraries

this is error

0|server | return new BadRequestError(status, error, message, headers);
0|server | ^
0|server | Error: 400 ‘$.input’ is invalid. Please check the API reference:
0|server | at Function.generate (/server/node_modules/openai/src/error.ts:66:14)
0|server | at OpenAI.makeStatusError (/server/node_modules/openai/src/core.ts:358:21)
0|server | at OpenAI.makeRequest (/server/node_modules/openai/src/core.ts:416:24)
0|server | at processTicksAndRejections (node:internal/process/task_queues:95:5)
0|server | server/node_modules/langchain/dist/embeddings/openai.cjs:223:29
0|server | at RetryOperation._fn (/server/node_modules/p-retry/index.js:50:12)

I was getting the same error with the Python client. You need to strip new lines from the beginning and end of the text in the documents. Hope it helps.