Git Product home page Git Product logo

laravel-uppy-s3-multipart-upload's Issues

It doesn't work with uppy v2

Uppy Companion V2, now handles, signature batching. Unfortunately I don't have time to contribute but I wish...
This will solve your issue in your controller and make it Uppy 2 compatible:

public function prepareUploadPart(Request $request, $uploadId, $batch)
{
    $key = $this->encodeURIComponent($request->input('key'));

    $partNumbers = explode(",", $request->partNumbers);

    $urls = [];
    foreach ($partNumbers as $partNumber) {
        $command = $this->client->getCommand('uploadPart', [
            'Bucket'     => $this->bucket,
            'Key'        => $key,
            'UploadId'   => $uploadId,
            'PartNumber' =>  (int) $partNumber,
            'Body'       => '',
        ]);

        $urls[$partNumber] = (string) $this->client->createPresignedRequest($command, '+2 hour')->getUri();
    }

    return response()
        ->json([
            'presignedUrls' => $urls,
        ]);
}

Headless support

Would like to configure this as kind of a headless companion for uppy. In my case the client is a detached react app which authenticates with the laravel API using sanctum/tokens

Instead of using web routes, I would like to use API routes with the 'auth:sanctum' middleware. Would it be of interest to submit a PR with these modifications. Perhaps adding middleware/guard details to the config?

Tapp\LaravelUppyS3MultipartUpload\Http\Controllers\UppyS3MultipartController::encodeURIComponent(): Argument #1 ($str) must be of type string, null given

Hi there,

First of all, congrats for the initiative, perfect package!

Now, I've had my log full of this particular issue:

Tapp\LaravelUppyS3MultipartUpload\Http\Controllers\UppyS3MultipartController::encodeURIComponent(): Argument #1 ($str) must be of type string, null given

Full stack:
[2023-05-07 21:25:19] production.ERROR: Tapp\LaravelUppyS3MultipartUpload\Http\Controllers\UppyS3MultipartController::encodeURIComponent(): Argument #1 ($str) must be of type string, null given, called in /home/forge/office.motorcyclesports.net/vendor/tapp/laravel-uppy-s3-multipart-upload/src/Http/Controllers/UppyS3MultipartController.php on line 339 {"exception":"[object] (TypeError(code: 0): Tapp\\LaravelUppyS3MultipartUpload\\Http\\Controllers\\UppyS3MultipartController::encodeURIComponent(): Argument #1 ($str) must be of type string, null given, called in /home/forge/office.motorcyclesports.net/vendor/tapp/laravel-uppy-s3-multipart-upload/src/Http/Controllers/UppyS3MultipartController.php on line 339 at /home/forge/office.motorcyclesports.net/vendor/tapp/laravel-uppy-s3-multipart-upload/src/Http/Controllers/UppyS3MultipartController.php:30) [stacktrace] #0 /home/forge/office.motorcyclesports.net/vendor/tapp/laravel-uppy-s3-multipart-upload/src/Http/Controllers/UppyS3MultipartController.php(339): Tapp\\LaravelUppyS3MultipartUpload\\Http\\Controllers\\UppyS3MultipartController->encodeURIComponent() #1 /home/forge/office.motorcyclesports.net/vendor/tapp/laravel-uppy-s3-multipart-upload/src/Http/Controllers/UppyS3MultipartController.php(301): Tapp\\LaravelUppyS3MultipartUpload\\Http\\Controllers\\UppyS3MultipartController->getSignedUrl() #2 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): Tapp\\LaravelUppyS3MultipartUpload\\Http\\Controllers\\UppyS3MultipartController->signPartUpload() #3 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction() #4 /home/forge/office.motorcyclesports.net/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingControllerDispatcherTracing.php(21): Illuminate\\Routing\\ControllerDispatcher->dispatch() #5 /home/forge/office.motorcyclesports.net/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingRoutingDispatcher.php(31): Sentry\\Laravel\\Tracing\\Routing\\TracingControllerDispatcherTracing->Sentry\\Laravel\\Tracing\\Routing\\{closure}() #6 /home/forge/office.motorcyclesports.net/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingControllerDispatcherTracing.php(20): Sentry\\Laravel\\Tracing\\Routing\\TracingRoutingDispatcher->wrapRouteDispatch() #7 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Routing/Route.php(259): Sentry\\Laravel\\Tracing\\Routing\\TracingControllerDispatcherTracing->dispatch() #8 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\\Routing\\Route->runController() #9 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Routing/Router.php(798): Illuminate\\Routing\\Route->run() #10 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}() #11 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #12 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Routing/Router.php(797): Illuminate\\Pipeline\\Pipeline->then() #13 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Routing/Router.php(776): Illuminate\\Routing\\Router->runRouteWithinStack() #14 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Routing/Router.php(740): Illuminate\\Routing\\Router->runRoute() #15 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Routing/Router.php(729): Illuminate\\Routing\\Router->dispatchToRoute() #16 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch() #17 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}() #18 /home/forge/office.motorcyclesports.net/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/SetRequestIpMiddleware.php(45): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #19 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Sentry\\Laravel\\Http\\SetRequestIpMiddleware->handle() #20 /home/forge/office.motorcyclesports.net/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/SetRequestMiddleware.php(30): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #21 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Sentry\\Laravel\\Http\\SetRequestMiddleware->handle() #22 /home/forge/office.motorcyclesports.net/app/Http/Middleware/LocaleHeader.php(18): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #23 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\\Http\\Middleware\\LocaleHeader->handle() #24 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #25 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle() #26 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle() #27 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #28 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle() #29 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle() #30 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #31 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle() #32 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #33 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle() #34 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(62): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #35 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle() #36 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #37 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle() #38 /home/forge/office.motorcyclesports.net/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Middleware.php(52): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #39 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Sentry\\Laravel\\Tracing\\Middleware->handle() #40 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #41 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then() #42 /home/forge/office.motorcyclesports.net/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter() #43 /home/forge/office.motorcyclesports.net/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle() #44 {main} "}

I am using Laravel 10.

Any idea of might be causing this?

Best regards

File validation (backend)

Hi there :)

First of all, thanks for providing this!

Is there a way to validate the file type on the server? I couldn't find anything in the source for this :)

Thanks!

Error if AWS_USE_ACCELERATE_ENDPOINT=true (works fine if FALSE)

Project based on Laravel 10.

If in the .env file I enable: AWS_USE_ACCELERATE_ENDPOINT=true
After browsing for a file, uploader throws an error.

And works fine when: AWS_USE_ACCELERATE_ENDPOINT=false

RESPONSE:

"message": "Call to undefined method Aws\Exception\UnresolvedEndpointException::getStatusCode()",
"exception": "Error",
"file": "...\vendor\tapp\laravel-uppy-s3-multipart-upload\src\Http\Controllers\UppyS3MultipartController.php",
"line": 122,
"trace": [
{
"file": "...\vendor\laravel\framework\src\Illuminate\Routing\Controller.php",
"line": 54,
"function": "createMultipartUpload",
"class": "Tapp\LaravelUppyS3MultipartUpload\Http\Controllers\UppyS3MultipartController",
"type": "->"
}

HEADERS:

{
"POST": {
"scheme": "http",
"host": "127.0.0.1:8000",
"filename": "/s3/multipart",
"remote": {
"Address": "127.0.0.1:8000"
}
}
}
{
"Status": "500Internal Server Error",
"Version": "HTTP/1.1",
"Transferred": "11.57 kB (11.29 kB size)",
"Referrer Policy": "strict-origin-when-cross-origin",
"DNS Resolution": "System"
}

Incompatable with latest version of Uppy

When Uppy version 3 is installed like this:

"@uppy/aws-s3-multipart": "^3.1.2",
"@uppy/core": "^3.0.5",
"@uppy/drag-drop": "^3.0.1",
"@uppy/status-bar": "^3.0.1",

a 404 error is thrown as soon as a file is uploaded.

Using version 2.0.2 as recommend in the documentation works.

Variable not initialized

Hi great package, very helpful.. Thanks a lot.

I was wondering where the $partResponse['NextPartNumberMarker'] is being initialized at line 172. My IDE flags it as not initialized, even though this being a recursive call.

private function listPartsPage($key, $uploadId, $partIndex, $parts = null)
{
$parts = $parts ?? collect();
$results = $this->client->listParts([
'Bucket' => $this->bucket,
'Key' => $key,
'UploadId' => $uploadId,
'PartNumberMarker' => $partIndex,
]);
if ($results['Parts']) {
$parts = $parts->concat($results['Parts']);
if ($results['IsTruncated']) {
$results = $this->listPartsPage($key, $uploadId, $partResponse['NextPartNumberMarker'], $parts);
$parts = $parts->concat($partResponse['Parts']);
}
}

createMultipartUpload throwing aws Host override error

A new issue popped up after doing a fresh deploy which appears to result from updates with the AWS SDK but unclear to me if this new error is on the Uppy side of things, the laravel side of things or with AWS itself.

The call to $this->client->createMultipartUpload in UppyS3MultipartController (line 103) is throwing the error Host override cannot be combined with Dualstack, FIPS, or S3 Accelerate from AWS.

There doesn't appear to be a lot of details on this error. I'm curious if others are getting it as my uploading has been very stable for many months with no changes.

Also, the exception being thrown does not support $exception->getStatusCode() which needs to be removed from the try/catch in order to see the actual error from AWS.

Thanks from the Drupal community!

Not an issue, but wanted to say thank you! This has helped us create a module for the Drupal community. Your excellent documentation in the controller allowed for a smooth port and easy understanding of all the required parts.

The module is still in the works but when it is complete, I'll post an update.

Much appreciated and well done!

Uppy is not a constructor

I tried to follow the instructions only difference being I used the CDNs and uppy doesn't show up in the console I'm getting this error any ideas I'm using this CDN <script src="https://releases.transloadit.com/uppy/v2.0.2/uppy.min.js"></script> and <script src="//unpkg.com/alpinejs" defer></script>

Uncaught TypeError: Uppy is not a constructor at eval (eval at <anonymous> (alpinejs:5:599), <anonymous>:27:26) at alpinejs:5:936 at Vt (alpinejs:1:4604) at w (alpinejs:5:79) at alpinejs:5:27365 at Function.<anonymous> (alpinejs:5:10229) at r (alpinejs:5:1652) at n (alpinejs:5:1682) at Qt (alpinejs:5:1692) at S (alpinejs:5:4344) at alpinejs:5:3867 at Array.forEach (<anonymous>) at Object.nr [as start] (alpinejs:5:3855) at alpinejs:5:32510

Laravel 9 support

Trying to install this on a Laravel 9 project but get the following composer error:

  Problem 1
    - Root composer.json requires tapp/laravel-uppy-s3-multipart-upload ^0.4.0 -> satisfiable by tapp/laravel-uppy-s3-multipart-upload[v0.4.0].
    - tapp/laravel-uppy-s3-multipart-upload v0.4.0 requires illuminate/contracts ^8.0 -> found illuminate/contracts[v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.

Any chance we can get illuminate/contracts upgraded to v9?

Other s3 Providers?

I tried to get this to work with DigitalOcean and I can't seem to. It continues to post to s3 even when I update the aws_url to something else. Is it possible to make this work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.