Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s3store upload error: hide error from user #1175

Open
webspec2012 opened this issue Aug 22, 2024 · 3 comments
Open

s3store upload error: hide error from user #1175

webspec2012 opened this issue Aug 22, 2024 · 3 comments
Labels

Comments

@webspec2012
Copy link

Question

We use the s3 upload directly. We catch errors on some uploads, an example of the log is below. We haven't figured out the reason yet, but first of all we want to hide from the user how detailed the error description is. How can this be done? I haven't found a solution yet.

`
{"time":"2024-08-22T13:19:59.697853753Z","level":"INFO","msg":"ResponseOutgoing","method":"POST","path":"","requestId":"f6227fd5e948b924578c3403125c9104","id":"QeUe99-_FVSY/3406cddaa43b+2~EEgYszRm2E6LiEqfb-LLIiPfIPLiqN7","status":500,"body":"ERR_INTERNAL_SERVER_ERROR: Multiple errors occurred:\n\toperation error S3: UploadPartCopy, https response error StatusCode: 404, RequestID: tx00000b777520c977ce67d-0066c73aff-1c7c0-dt-rt1, HostID: 1c7c0-dt-rt1-rt, api error NoSuchKey: UnknownError\n\toperation error S3: UploadPartCopy, https response error StatusCode: 404, RequestID: tx00000c8514efd82efebbd-0066c73aff-19c78-dt-rt1, HostID: 19c78-dt-rt1-rt, api error NoSuchKey: UnknownError\n\toperation error S3: UploadPartCopy, https response error StatusCode: 404, RequestID: tx00000d0c54e26d009f2e8-0066c73aff-1c3b8-dt-rt1, HostID: 1c3b8-dt-rt1-rt, api error NoSuchKey: UnknownError\n\toperation error S3: UploadPartCopy, https response error StatusCode: 404, RequestID: tx0000006d47737b26c2532-0066c73aff-1c7c0-dt-rt1, HostID: 1c7c0-dt-rt1-rt, api error NoSuchKey: UnknownError\n\toperation error S3: UploadPartCopy, https response error StatusCode: 404, RequestID: tx00000e2d81c2028e03c11-0066c73aff-1c304-dt-rt1, HostID: 1c304-dt-rt1-rt, api error NoSuchKey: UnknownError\n\n"}

{"time":"2024-08-22T13:19:59.697686104Z","level":"ERROR","msg":"InternalServerError","method":"POST","path":"","requestId":"f6227fd5e948b924578c3403125c9104","id":"QeUe99-_FVSY/3406cddaa43b+2~EEgYszRm2E6LiEqfb-LLIiPfIPLiqN7","message":"Multiple errors occurred:\n\toperation error S3: UploadPartCopy, https response error StatusCode: 404, RequestID: tx00000b777520c977ce67d-0066c73aff-1c7c0-dt-rt1, HostID: 1c7c0-dt-rt1-rt, api error NoSuchKey: UnknownError\n\toperation error S3: UploadPartCopy, https response error StatusCode: 404, RequestID: tx00000c8514efd82efebbd-0066c73aff-19c78-dt-rt1, HostID: 19c78-dt-rt1-rt, api error NoSuchKey: UnknownError\n\toperation error S3: UploadPartCopy, https response error StatusCode: 404, RequestID: tx00000d0c54e26d009f2e8-0066c73aff-1c3b8-dt-rt1, HostID: 1c3b8-dt-rt1-rt, api error NoSuchKey: UnknownError\n\toperation error S3: UploadPartCopy, https response error StatusCode: 404, RequestID: tx0000006d47737b26c2532-0066c73aff-1c7c0-dt-rt1, HostID: 1c7c0-dt-rt1-rt, api error NoSuchKey: UnknownError\n\toperation error S3: UploadPartCopy, https response error StatusCode: 404, RequestID: tx00000e2d81c2028e03c11-0066c73aff-1c304-dt-rt1, HostID: 1c304-dt-rt1-rt, api error NoSuchKey: UnknownError\n"}
`

@Acconut
Copy link
Member

Acconut commented Aug 22, 2024

Currently, there is no feature to hide such errors. But I agree, it would be useful to have this. Let me know if you are interested in helping implement it.

@webspec2012
Copy link
Author

yes, I would really like to have such functionality.

@Acconut
Copy link
Member

Acconut commented Aug 22, 2024

All that is needed is an option to send a generic error message when an internal server error occurs at

c.log.Error("InternalServerError", "message", err.Error())
detailedErr = NewError("ERR_INTERNAL_SERVER_ERROR", err.Error(), http.StatusInternalServerError)

So err.Error() should be replaced with a generic message, but only when a certain option/flag is enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants