-
Notifications
You must be signed in to change notification settings - Fork 0
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
Task/WP-505: APCD File Upload Failures Logging Request #1013
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1013 +/- ##
==========================================
- Coverage 72.88% 72.84% -0.05%
==========================================
Files 534 534
Lines 33455 33480 +25
Branches 2981 2981
==========================================
+ Hits 24385 24387 +2
- Misses 8875 8898 +23
Partials 195 195
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -492,6 +492,10 @@ export async function uploadFileUtil(api, scheme, system, path, file) { | |||
body: formData, | |||
}); | |||
if (!request.ok) { | |||
if (request.status === 403 || request.status === 500) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put a try catch around line 488 to line 498 to do the following? A frequent issue we see is the client side network is blocking file uploads (firewall settings), since the firewall is blocking it, sometimes, it might not even be a http response.
try {
const request = await fetch(url, {
method: 'POST',
headers: { 'X-CSRFToken': Cookies.get('csrftoken') },
credentials: 'same-origin',
body: formData,
});
if (!request.ok) {
throw new Error(`HTTP error: ${request.status}`);
}
return request;
} catch (error) {
if (error instanceof TypeError) {
throw new Error('Network error: The file upload was blocked.');
}
throw error;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After seeing your screenshot on error message, I'm not sure how much that error is going to help or cause more problems. We want to know the user to know if file upload is blocked vs server http error.
May be a simpler error message:
- http response code - put the response code and say file upload server failed with response code: {}
- when there is no response code, then show the message TypeError catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After seeing your screenshot on error message, I'm not sure how much that error is going to help or cause more problems. We want to know the user to know if file upload is blocked vs server http error.
May be a simpler error message:
- http response code - put the response code and say file upload server failed with response code: {}
- when there is no response code, then show the message TypeError catch.
@chandra-tacc
This is a great suggestion. It would be best to test for both types of occurrences when a file is uploaded. One where the firewall is blocking the request (the catch variant) and the other for when the POST request is successful. I'll edit the success message down as well as to not overcomplicate things. Thank you for the thorough review Chandra!
New screenshots added with changes from try catch for http and network errors |
Overview
APCD For file upload failures, show response for 403 errors
Related
Changes
Testing steps to reproduce an error output in an isolated upload modal
server/portal/settings/settings_default.py:230
client/src/components/Submissions/Submissions.jsx:22
2. Comment out, then below it write
client/src/components/Submissions/Submissions.jsx:128
3. Comment out, then below it write
UI
Notes
Must be implemented in Core Portal