The error code 137 is usually caused by the operating system killing the Python process due to an out-of-memory error. According to the documentation, the Azure Functions platform has a service limitation that terminates any function apps that exceed the memory limit.
You can try to analyze the memory bottleneck in your function app by visiting the tutorial section in memory profiling on Python functions.
If you have already done that and the issue still persists, you can try to reduce the memory usage of your function app by optimizing the code, reducing the size of data structures.