Replies: 1 comment 3 replies
-
With a function/class handler, anything returned is a success, and any exception thrown is a failure. So you should be able to throw an exception and be done with it. But anyway, regarding your example it looks incomplete: the Do you want a function where the CLI arguments of the artisan command are hardcoded? Or do you want to pass the arguments (the JSON thing) dynamically when invoking the function? Also how do you invoke the function? It seems to me you are trying to achieve something in a way that is overcomplicated, maybe if you explain what you are trying to achieve we can find a better solution? |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am trying to pass JSON to my lambda that looks as following:
My custom artisan_test handler
What I struggle here is that if I pass a string to my lambda, then $_SERVER['argv'] gets populated, but if I pass JSON, then $_SERVER is empty.
I know that I can use the Bref Event pattern (https://bref.sh/docs/function/handlers.html), and this is what I do now, but it does not work for me since I can not return non-zero error codes. All my lambdas are treated as success regardless of the exit code.
Is there a way to achieve what I want apart of passing JSON as encoded string, and also being able to return an error code? It will be super nasty and will make my step functions way more complex.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions