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

Use with your own server section of AWS S3 contains misleading routes #213

Closed
nerg4l opened this issue Mar 26, 2024 · 5 comments · Fixed by #214
Closed

Use with your own server section of AWS S3 contains misleading routes #213

nerg4l opened this issue Mar 26, 2024 · 5 comments · Fixed by #214

Comments

@nerg4l
Copy link
Contributor

nerg4l commented Mar 26, 2024

The routes provided in the "Use with your own server" of AWS S3 uploader shows different endpoints than the endpoints used in the linked "Setup Uppy" example.

- `GET` > `/uppy/sts`: get the temporary security credentials (optional).
- `POST` > `/uppy/s3`: get parameters and pre-signed URL for non-multipart
upload.
- `POST` > `/uppy/s3-multipart`: create the multipart upload.
- `GET` > `/uppy/s3-multipart/:id`: get the uploaded parts.
- `GET` > `/uppy/s3-multipart/:id/:partNumber`: sign the part and return a
pre-signed URL.
- `POST` > `/uppy/s3-multipart/:id/complete`: complete the multipart upload.
- `DELETE` > `/uppy/s3-multipart/:id`: abort the multipart upload.

From the Setup Uppy example:

  • /sts
  • /sign-s3
  • /s3/multipart
  • /s3/multipart/${uploadId}
  • /s3/multipart/${uploadId}/${partNumber}
  • /s3/multipart/${uploadId}/complete
@nerg4l nerg4l changed the title Use with your own server section AWS S3 contains misleading routes Use with your own server section of AWS S3 contains misleading routes Mar 26, 2024
@Murderlon
Copy link
Member

Murderlon commented Mar 27, 2024

They are the same, it just shows that if you have an existing backend, perhaps even with existing s3 endpoints , you can just group them under /uppy route of whatever you'd like to do. When using the options for the s3 plugin you have to write the code manually anyway to call the backend.

@Murderlon Murderlon closed this as not planned Won't fix, can't repro, duplicate, stale Mar 27, 2024
@nerg4l
Copy link
Contributor Author

nerg4l commented Mar 27, 2024

Are you sure that only the prefix is different?

  • /uppy/sts
  • /uppy/s3
  • /uppy/s3-multipart
  • /uppy/s3-multipart/:id
  • /uppy/s3-multipart/:id/:partNumber
  • /uppy/s3-multipart/:id/complete

The documentation uses s3-multipart but the linked code example uses s3/multipart. Also the sign route is completely different.

@Murderlon
Copy link
Member

Maybe the docs are misleading, but it just needs to match. You can do this if you want:

On the server:

app.post('/my/supercool/endpoint', (req, res, next) => {}

And then on the client:

const response = await fetch('/my/supercool/endpoint', {
  method: 'POST',
  // Send and receive JSON.
  headers: {
    accept: 'application/json',
  },
  body: serialize({
    filename: file.name,
    type: file.type,
    metadata,
  }),
  signal,
})

It's a lot of manual work. Ideally, we'd have @uppy/server-functions which you can use on the server, and force people to have the same endpoints as companion. Then I think you wouldn't need to manually write this.

@Murderlon Murderlon reopened this Mar 27, 2024
@nerg4l
Copy link
Contributor Author

nerg4l commented Mar 27, 2024

Agreed, a companion compatible uploader config would be even better.

I was considering this option but could not find any documentation of the current endpoints used by Companion. I can dig through the code of course but I would prefer to have it in a more readable way.

@Murderlon
Copy link
Member

I created two issues for it:

In the meantime if you're willing to contribute a PR to make the writing more clear in the current docs that would be great :)

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

Successfully merging a pull request may close this issue.

2 participants