-
Notifications
You must be signed in to change notification settings - Fork 10
Errors in create function with zip-file can get very long #36
Comments
Are you yourself printing the response map (e.g. REPL etc.), as opposed to elements of the response being printed in Eulalie? Are you using If the input is repeated in the error message, you could certainly do something like: (defn- ellipsize [s & [{:keys [limit] :or {limit 5000}]]
(if (< limit (count s))
(str (subs s 0 limit) "...")
s))
(defmethod eulalie/transform-response-error :eulalie.service/lambda
[{body :body error :error}]
(assoc error :message (some-> body platform/decode-json :message ellipsize))) General-purpose abbreviation of the response's |
Yeah I'm using issue-request and directly printing the result:
The full response is here: https://gist.github.com/lfn3/d3231da6550e61e1cb6e7fa66311cd1e, specifically line 20 and 45. I don't think I want to ellipsize the entire body of the request either. Do you think it would be reasonable to replace the encoded body with the untransformed map and ellipsize the zipfile in there? |
I think it's borderline unreasonable to do that in Eulalie (though you could totally do this in your project by implementing those multimethods), but that may be because I don't look too often at the raw responses. The request maps often get big - if this is a big deal for you, as far as Eulalie changes, I'd personally prefer sticking the request in a One other thing is there's stuff in |
So I totally introduced this one, but I'm not really sure how to deal with it 😕
Right now if you pass a create-function request, using the
:zip-file
parameter to push a base64 encoded string up, and it errors (e.g. a bad arn), it'll print out that string a couple of times. For my quick hacked together test of a lambda function that uploads itself, that resulted in printing just under six millions characters. (It's in both the request and body bits of the error message)So I would like to exclude it from the error message, if possible (I'm assuming in general these will be logged somewhere, and a base64 encoded zip isn't amazingly useful as a debugging aid, especially since you could just dump it directly to disk?).
Since it's in an already encoded string the only thing I can think off the top of my head to deal with it is a regex which seems like a bad idea. I'm looking for other ideas of how to remove it, if anyone has any.
Thanks in advance!
The text was updated successfully, but these errors were encountered: