Skip to content

Add Attachments to the challenge specification #917

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

Open
maxceem opened this issue Nov 27, 2020 · 35 comments
Open

Add Attachments to the challenge specification #917

maxceem opened this issue Nov 27, 2020 · 35 comments

Comments

@maxceem
Copy link
Contributor

maxceem commented Nov 27, 2020

As API already supports it, we have to support adding attachments for the challenge specification.

FYI @vikasrohit

@maxceem maxceem self-assigned this Nov 27, 2020
@vikasrohit vikasrohit added this to the 0.3.0 milestone Nov 27, 2020
@rootelement
Copy link
Contributor

Challenge API supports Attachments. You'll need to upload through the UI via the Filestack widget into the S3 bucket, then submit that s3 URL as the attachment URL. Then the challenge api will handle security and retrieval of the attachment.

@maxceem
Copy link
Contributor Author

maxceem commented Dec 2, 2020

Thanks, @rootelement. This is how we implement it now in Work Manager. I only had an issue with creating attachments, as it didn't allow S3 bucket that I used see #737 (comment). But I guess you've already whitelisted the bucket for me, as I contacted Thomas for this. Would give some time for the deployment and try it again.

submission-staging-dev
topcoder-dev-media
tc-challenge-v5-dev

maxceem added a commit to maxceem/work-manager that referenced this issue Dec 3, 2020
- Support drag & drop for multiple attachments

ref issue topcoder-platform#917
maxceem added a commit to maxceem/work-manager that referenced this issue Dec 3, 2020
@maxceem
Copy link
Contributor Author

maxceem commented Dec 4, 2020

@vikasrohit file uploading is done via PR #931

See demo video: https://monosnap.com/file/I4B4UsRVCtJBQv1wzraQwwvkcvibNF

Though there is some issue with config, so I use the incorrect FileStack/AWS bucket config, because it doesn't work for me with the correct one. As was clarified by @rootelement (on Slack) we have to upload challenge attachments to tc-challenge-v5-dev bucket. But if I config this bucket I get 403 error during uploading files to AWS via FileStack:

image

But if I only change the bucket to submission-staging-dev the same code works for me, and I can upload files to AWS via FileStack:

image

But Challenge API doesn't allow creating attachments with submission-staging-dev because this bucket is not whitelisted. So to be able to test I had to set the bucket tc-challenge-v5-dev for attachments when creating them in Challenge API:

image

So as result I upload files to submission-staging-dev but tell Challenge API that file is uploaded to tc-challenge-v5-dev so it accepts my POST requests 🤯

This might lead to the next issues I have:

  • When I reload the challenge page, not all uploaded attachments are returned by Chalelnge API (even though all POST request were successful)
  • I cannot download attachments as the server returns Internal server error. This is logical as I misconfigured buckets.
  • I cannot remove attachments as the server returns Internal server error. This could be also logical if the server tries to clean file and cannot find it on the misconfigured bucket.

So we have to find out why we cannot upload files to tc-challenge-v5-dev AWS, while can upload to submission-staging-dev. There must be something with FileStack or AWS configuration.

@vikasrohit
Copy link

@rootelement @mtwomey can you guys help us here?

@rootelement
Copy link
Contributor

I've reached out to Guna to fix the s3 bucket. @vikasrohit this is exactly like how the file upload in community app works. The idea is using the Filestack Dev key to upload to the tc-challenge-v5-dev bucket, then the challenge api should be able to read from it. I'm unclear how the frontend of filestack works, but if you're using this filestack api key in dev: AzFINuQoqTmqw0QEoaw9az you should be able to write to the tc-challenge-v5-dev bucket.

Matt and I will look into uploading to a workflow so things are virus scanned automatically.

I will confirm here when Guna has fixed the security issue.

@vikasrohit
Copy link

@rootelement Do we have confirmation for S3 bucket? @maxceem can you please give it a try in case it has been fixed?

@maxceem
Copy link
Contributor Author

maxceem commented Dec 8, 2020

@vikasrohit it's still forbidden for tc-challenge-v5-dev bucket:

image

@maxceem
Copy link
Contributor Author

maxceem commented Dec 9, 2020

@vikasrohit Uploading attachments work well now end-to-end now.

There is only one issue with Challenge API when adding multiple attachments at once:

  • we send multiple POST /challenges/:id/attachments requests in parallel and all of them are successful
  • but after I reload the challenge GET /challenge/:id returns only one attachment

See demo video https://monosnap.com/file/mVqe0igPbDIa68bUepKwRujaTU0mQN

Example challenge 29d3d66f-d87f-402f-882f-258235ac7a6f on DEV.

I've logged an issue on Challenge API topcoder-platform/challenge-api#348.
FYI @ThomasKranitsas

@vikasrohit
Copy link

vikasrohit commented Dec 10, 2020

Can we merge it now @maxceem ?

Sorry @maxceem I didn't read your message, it was a stale UI which didn't show me your latest message.

I guess, as it has issues right now, I would like to wait further to get it resolved.

@vikasrohit
Copy link

@maxceem I am merging PR now as it seems the issue topcoder-platform/challenge-api#348 is fixed.

@maxceem
Copy link
Contributor Author

maxceem commented Jan 12, 2021

@vikasrohit looks like something is not configured properly on DEV. When I'm trying to add attachments I'm getting errors from AWS services I guess:

image

@maxceem
Copy link
Contributor Author

maxceem commented Jan 12, 2021

@vikasrohit locally the issue above is not reproducible and works good for me:

image

The endpoint in challenge API has changed, so we would have to update UI code first before attachments creation would work.

So I've reverted the PR #1035 for now, just in case we couldn't update it before the Jan 15th release.

@maxceem
Copy link
Contributor Author

maxceem commented Jan 20, 2021

Uploading attachments on DEV works good. But on PROD there seems to be some config issue as uploading fails during uploading files to AWS S3 due to 403 permission errors:

start was good:
image

upload was good:
image

but actual uploading to S3 failed because of authentication issue 403:
image

@vikasrohit vikasrohit modified the milestones: 0.4.0, 0.6.0 Jan 22, 2021
@vikasrohit
Copy link

vikasrohit commented Jan 22, 2021

Moving it out to next milestone after Project Defaults shape up project as we are not able to get it working in production. We need latest challenge api in production to get it working.

fyi @acshields

@acshields
Copy link

@vikasrohit - noted.

@maxceem
Copy link
Contributor Author

maxceem commented Feb 19, 2021

@vikasrohit looks like Challenge API has been deployed to PROD topcoder-platform/challenge-api@master...develop so we might give it another try.

@vikasrohit
Copy link

Yep, we can. But I would like to work on it only when we have its consumers i.e. some app is using the attachments.

@vikasrohit
Copy link

@acshields @rootelement do you know if Community/Forums app is already have code or plans to use the challenge Attachments?

@rootelement
Copy link
Contributor

I believe Community App will read attachments. I think that needs to be tested. Forums uses their own attachments mechanism, but i don't believe they're reading challenge-api attachments at all. The security on the endpoint for attachments requires you're registered on the challenge as a submitter (or above... copilot, manager, observer) to get the attachments.

@vikasrohit
Copy link

Okay, thanks for the updates @rootelement. @acshields let us know how you want to prioritize it, IMO, we should do it once we have confirmation on the usage of attachments.

@acshields
Copy link

@vikasrohit - for my clarity, when you say confirmation on the usage of attachments, are you referring to the forums usage of attachments?

@vikasrohit
Copy link

I meant any kind of usage of the challenge attachments. I am not sure where exactly we want to consume the attachments of the challenge, but what I want to say is that we should retest this feature and deploy to prod when we know there is some consumer of this feature whether it is Community app or forums.

@vikasrohit
Copy link

@acshields moving it out from bug fix cycle.

@acshields
Copy link

@vikasrohit - noted. Right now, I have this as an aspect of the new UI implementation for WM. If that project pitch gets accepted for the next round, we could group this into that effort.

@vikasrohit vikasrohit modified the milestones: 0.8.0, 0.10.0 May 17, 2021
@yoution
Copy link
Contributor

yoution commented Jul 1, 2021

@phead198708 please assign to me

@yoution
Copy link
Contributor

yoution commented Jul 2, 2021

@vikasrohit @acshields can you provide the new UI implementation?
currently the ui is like so
image

@vikasrohit vikasrohit modified the milestones: 0.11.0, Backlog Jul 2, 2021
@vikasrohit
Copy link

Sorry @yoution I guess this issue is not ready yet.

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

No branches or pull requests

6 participants