laravel sanctum guard trow Segmentation violation error

146 Views Asked by At

I would like to use sanctum as a guard, I switch the driver from session to sanctum and then this gives the error message. I don't know where to look for the error or which way to start.

'guards' => [
        'web' => [
            'driver' => 'session' -> // --> to this 'sanctum',
            'provider' => 'members',
        ],
In WorkerCrashedException.php line 41:

  The command "PARATEST='1' TEST_TOKEN='11' UNIQUE_TEST_TOKEN='11_63bbc9686d4b6' '/usr/local/bin/php' '/var/www/html/vendor/phpunit/phpunit/phpunit' '--configuration' '/var/www/html/phpunit.xml' '--filter' '/
  shouldRejectLoginAsMemberGivingCorrectPasswordAndGivingInvalidEmail(?:\s|$)/' '--no-logging' '--no-coverage' '--printer' 'ParaTest\Runners\PHPUnit\Worker\NullPhpunitPrinter' '--log-junit' '/tmp/PT_BPNPOL' '
  /var/www/html/tests/Unit/Controllers/AuthControllerTest.php'" failed.

  Exit Code: 139(Segmentation violation)

  Working directory: /var/www/html

  Output:
  ================


  Error Output:
  ================
1

There are 1 best solutions below

0
On

I also experienced the same issue in the same case and resolved it as follows. Laravel 10.

config/sanctum.php

    /*
    |--------------------------------------------------------------------------
    | Sanctum Guards
    |--------------------------------------------------------------------------
    |
    | This array contains the authentication guards that will be checked when
    | Sanctum is trying to authenticate a request. If none of these guards
    | are able to authenticate the request, Sanctum will use the bearer
    | token that's present on an incoming request for authentication.
    |
    */

    // 'guard' => ['my_api_guard'], <- In my case, this setting could reproduce `Exit Code: 139 error` .
    'guard' => [], // <- Please try using an empty array!