Comments (5)
@mj-nico23 , there's a solution in progress here: #115
Note that I had to change your implementation slightly.
from azure-functions-durable-python.
Hi @mj-nico23, thank you for reaching out!! ⚡ ⚡
Do you mind sharing the code you used for implementing the Singleton? It would help us reproduce your error with ease. In the meantime, I'll look at the exception logic and see if it makes sense to raise this error.
from azure-functions-durable-python.
Thanks for your reply @davidmrdavid.
I updated the first message with my singleton implementation.
from azure-functions-durable-python.
Bingo! I was able to reproduce this, @mj-nico23 . So this is actually a two part problem. I'll describe it below, as I think it's probably helpful to peek into the internals 😄
The first problem is that, when returning an empty body, our server isn't returning a JSON-formatted response, so the following method will fail error out:
That's where you see the exception Attempt to decode JSON with unexpected mimetype
. The fix is simple, we just have to tell aiohttp
not to expect a JSON, so the method looks like this now:
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
data = await response.json(content_type=None)
if data == None:
data = ""
return [response.status, data]
In the snippet above, if we receive a None
as our data, we know the response body was empty. If detect an empty body, we return the empty string since that's JSON-compatible. In your example, response.status
will correspond to 404
, as expected.
Here comes the second problem. So now we return to the following method:
https://github.com/Azure/azure-functions-durable-python/blob/dev/azure/durable_functions/models/DurableOrchestrationClient.py#L206
which is where we're supposed to handle error codes, but we aren't doing that yet as you see by that None
-filled switch statement. That's because this project is still in early stages, and not quite in a public preview stage yet. So the next step is to figure out what the right message is for the 404
error statement. I'll think about it and most likely submit a PR tomorrow to fix it.
Thank you so much for raising this issue. I'll look into fixing this tomorrow morning, PDT-time. In the meantime, if you find yourself interested in trying to implement the solution by yourself, I want to encourage you to do so and submit a PR! We're always excited to see community engagement, especially so early on. Regardless, I'll submit one at some point tomorrow morning in case you're not interested in that 😄 . Thanks again! ⚡ ⚡
Update:
Hmm, even after those changes, and in order to get your example working, perhaps we'll need to implement one more step, where we watch that exception in the get_status
method and return False
if the 404
exception is caught...or something like that. We'll have to think about it.
from azure-functions-durable-python.
This was already merged, so I'll be closing this. Thank you for reporting it :)
from azure-functions-durable-python.
Related Issues (20)
- Remove 1.2.0 from pypi HOT 1
- Official support for "dynamic" functions HOT 3
- Add to docs what types are supported out of the box
- support EeventHub trigger directly HOT 2
- context.is_replaying does not always work properly in Python Durable Functions
- Fan-out fan-in task_all exception thrown workaround throwing errors HOT 7
- [ignore] testing fabricbot
- Incorrect error message in `DurableOrchestrationClient.terminate()`
- V2 func start doesnt work for samples HOT 1
- Fan-In/Fan-Out cloud back example problems... HOT 3
- Improved documentation (programming model v2)
- Orchestration Trigger via FastAPI HOT 6
- No way to co-relate activity logs with Orchestrator Functions in Python HOT 1
- Coverage for integration testing for orchestrator and activity functions HOT 1
- FastAPI with Blueprints returns "detail: Not Found" HOT 5
- Default Python Function App Broken Behaviour HOT 10
- ❓Survey: Your experience with Durable Functions
- How to use the msgraph-sdk in activities? HOT 3
- Activites cannot return None (the JSON object must be str, bytes or bytearray, not NoneType) HOT 6
- Adaptive Cards in durable functions not sending correct message.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-functions-durable-python.