I was reading through this tutorial on managing functions with App Platform: https://docs.digitalocean.com/products/app-platform/how-to/manage-functions/.
It says this:
Opening the live URL of a function directly in your browser can result in errors if your function is expecting input parameters. Use API testing tools like Postman,
curl
, or your programming language’s HTTP client library to test the URL with properly formatted HTTP requests.
How do I make a properly formatted HTTP request? I don’t see anything that says how.
In Insomnia (similar to Postman), I tried the following for the url https://site.ondigitalocean.app/COMPONENT/PACKAGE/FUNCTION
For all of these, I tried passing Basic MY_AUTH_TOKEN
that I use for normal functions. Nothing I do works. I always get a 400 Bad Request
with the following error:
{
"code": "0570a2968654cb1831572b65bab68416",
"error": "There was an error processing your request."
}
Just wondering what I’m doing wrong so I can get this working.
Thanks,
Joshua.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there,
The exact format of your HTTP request depends on the specific implementation of the serverless function you’re calling. If the function is expecting parameters, you’ll need to ensure that you’re providing these parameters in the correct format and location (such as in the query string, the HTTP headers, or the request body), and with the correct HTTP verb (like GET or POST).
The error message you’re seeing, “There was an error processing your request,” is a very general one and could be caused by a variety of issues. However, since you’re receiving a 400 status code, that typically means the server thinks you’ve made a bad request. This could be due to missing or incorrect parameters.
If you were to go to the App Platform logs, do you see any errors recorded there?
Also is your function open-source? If so can you share it here so I could check out what parameters it’s expecting and what might be going wrong?
UPDATE: Joshua got this working after upgrading the function to Python 3.11 and all of its dependencies and he’s now able to call it through App Platform and he is getting a 204 instead of a 400.
Best,
Bobby