Giter VIP home page Giter VIP logo

Comments (19)

ankitpokhrel avatar ankitpokhrel commented on May 23, 2024 1

message | Server error: HEAD http://dancenote.test/files/a885eae6a4904422193a8a7584287c2b resulted in a 500 Internal Server Error response

@alexandrelgy you can find laravel logs in storage/logs. Please check the logs and try to figure out the issue first. We can't help unless you provide us enough info about the issue.

from tus-php.

alexandrelgy avatar alexandrelgy commented on May 23, 2024 1

Forgot to create it. Directory was missing what a fool.
It seems to work (pause resume and so on).

Really thank you you've been great help !

from tus-php.

ankitpokhrel avatar ankitpokhrel commented on May 23, 2024

Ping @DrudgeRajen

from tus-php.

DrudgeRajen avatar DrudgeRajen commented on May 23, 2024

@alexandrelgy Checked your error.txt file.

 "message": "Client error: `SETKEY http://dancenote.test/7e80d1faddb9611c4d82e21eed1bb68d` resulted in a `404 Not Found`

Instead of 405 there is 404 error. Can you please share what you have kept in your Service Provider (to run server) of Laravel? Did you follow this doc properly?

from tus-php.

alexandrelgy avatar alexandrelgy commented on May 23, 2024

Yes I did followed this doc ! I might have missed something basic?
Then would 404 come from a route I did not register in a proper way ?

Here is the service provider :

Service Provider


<?php

namespace App\Providers;

use TusPhp\Tus\Server as TusServer;
use Illuminate\Support\ServiceProvider;

class TusServiceProvider extends ServiceProvider
{
    // ...

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('tus-server', function ($app) {
            $server = new TusServer('redis');

            $server
                ->setApiPath('/tus') // tus server endpoint.
                ->setUploadDir(storage_path('app/public/uploads')); // uploads dir.

            return $server;
        });
    }

    // ...
}   

from tus-php.

DrudgeRajen avatar DrudgeRajen commented on May 23, 2024

@alexandrelgy Just remove

 ->setApiPath('/tus') // tus server endpoint.

this line from your service provider.
And from your route remove this

Route::any('/tus/{any?}', function () {
    $response = app('tus-server')->serve();
    return $response->send();
})->where('any', '.*');

and Replace

$client = new \TusPhp\Tus\Client('http://dancenote.test/tus');

with

$client = new \TusPhp\Tus\Client('http://dancenote.test/');

Let me know if doesn't work.

from tus-php.

alexandrelgy avatar alexandrelgy commented on May 23, 2024

It seems like now the verify call does not work neither returning a 500 server error specifying

message | Server error: HEAD http://dancenote.test/files/a885eae6a4904422193a8a7584287c2b resulted in a 500 Internal Server Error response

from tus-php.

DrudgeRajen avatar DrudgeRajen commented on May 23, 2024

@alexandrelgy did you add TusServiceProvider class in config/app.php? Please check the doc again.

from tus-php.

alexandrelgy avatar alexandrelgy commented on May 23, 2024

Sure I did add this App\Providers\TusServiceProvider::class.
I'll check the doc once again and let you know if I did everything right !
@ankitpokhrel I'll also check logs and let you know if I figure out what's wrong.

Thanks for help to you both ! :)

from tus-php.

samundra avatar samundra commented on May 23, 2024

@alexandrelgy In any case, Could you please share your log file that's generated in storage/logs folder for the problem you are facing?

from tus-php.

alexandrelgy avatar alexandrelgy commented on May 23, 2024

Sure, here it is. I'm going to investigate it today and keep you updated.

laravel.log.txt

from tus-php.

DrudgeRajen avatar DrudgeRajen commented on May 23, 2024

@alexandrelgy After checking your log file, I found that Tus server is not able to connect to Redis Server.
If you don't want to use Redis server for caching then please replace

 $server = new TusServer('redis');

with

 $server = new TusServer();

In default, Tus server will use file as cache adapter.

from tus-php.

samundra avatar samundra commented on May 23, 2024

@alexandrelgy As per your provided log file this line

[2018-10-23 06:35:25] local.ERROR: Connection refused [tcp://127.0.0.1:6379] \{"exception":"[object] (Predis\\\\Connection\\\\ConnectionException(code: 61): Connection refused [tcp://127.0.0.1:6379] at /Users/fabrique/code/dancenote/vendor/predis/predis/src/Connection/AbstractConnection.php:155)

states that it was unable to connect to redis server when you tried to make request for the file.

from tus-php.

alexandrelgy avatar alexandrelgy commented on May 23, 2024

Nice thanks @samundra & @DrudgeRajen seems to work now !
I've been debugging a few things but i'm facing a response like :
Unable to open /directory/dancenote/storage/app/public/uploads/filnename.file_extension.

I'll investigate it tomorrow but if by any chance someone you have already faced the problem let me know ! :)

from tus-php.

samundra avatar samundra commented on May 23, 2024

Is your file uploaded successfully to upload directory /directory/dancenote/storage/app/public/uploads/filnename.file_extension ?

from tus-php.

DrudgeRajen avatar DrudgeRajen commented on May 23, 2024

@alexandrelgy For server you had set upload directory as

->setUploadDir(storage_path('app/public/uploads'));

So, please be sure you have uploads directory at storage/app/public

from tus-php.

jammersonf avatar jammersonf commented on May 23, 2024

I have the same problem. I already follow the instructions on this post, but i'm still in problem

Error:

"message": "Client error: SETKEY http://dev.bembras.api/75247b51bd97d93cd0094978a29b194e resulted in a 405 Method Not Allowed

web.php
image

TusServiceProvider.php
image

UploadController.php
`public function UploadTus()
{
$client = new \GuzzleHttp\Client(['base_uri'=>'http://dev.bembras.api', 'debug'=> true]);
// Alert: Sanitize all inputs properly in production code
if (! empty($_FILES)) {
$fileMeta = $_FILES['tus_file'];
$uploadKey = hash_file('md5', $fileMeta['tmp_name']);

        try {
            $client->setKey($uploadKey)->file($fileMeta['tmp_name'], time() . '_' . $fileMeta['name']);
            $bytesUploaded = $client->upload(5000000); // Chunk of 5 mb
            echo json_encode([
                'status' => 'uploading',
                'bytes_uploaded' => $bytesUploaded,
                'upload_key' => $uploadKey
            ]);
        } catch (ConnectionException | FileException | TusException $e) {
            echo json_encode([
                'status' => 'error',
                'bytes_uploaded' => -1,
                'upload_key' => '',
                'error' => $e->getMessage(),
            ]);
        }
    } else {
        echo json_encode([
            'status' => 'error',
            'bytes_uploaded' => -1,
            'error' => 'No input!',
        ]);
    }
}`

The Verify method is responding ok, the problem is only on upload.
Sorry for my bad English

from tus-php.

alexandrelgy avatar alexandrelgy commented on May 23, 2024

405 errors in Laravel are often linked with csrf security in Laravel.

I added an exception to my VerifyCsrfToken.php and it worked for me.
I do not know if it is or not a bad habit in term of system security for production code, but for local use it seems fine. If the problem does come from here i suggest to add csrf headers in your ajax request.

<?php

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;

class VerifyCsrfToken extends Middleware
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        '/verify',
        '/tus',
        '/tus/*',
        'files',
        'files/*',

        
            ];
}

from tus-php.

jammersonf avatar jammersonf commented on May 23, 2024

@alexandrelgy Really. I add o except and passed, but still with error.

Client error: POST http://dev.bembras.api/files` resulted in a 404 Not Found response:\nNo input file specified.\n\n",`

I already put the /files on virtualhost
image

Also changed the $client = new \GuzzleHttp\Client(['base_uri'=>'http://dev.bembras.api', 'debug'=> true]); by $client = new \TusPhp\Tus\Client('http://dev.bembras.api');on Upload Method

from tus-php.

Related Issues (20)

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.