Api: Unable to boot ApiServiceProvider, configure an API domain or prefix.

Created on 18 Jan 2017  路  11Comments  路  Source: dingo/api

I'm getting this error, I've tried everything... Its set in three places and STILL... Very frustrating. Occasionally I'm not getting the error... Can't find a pattern...

composer.json
"require": { "php": ">=5.6.4", "laravel/lumen-framework": "5.3.*", "vlucas/phpdotenv": "~2.2", "tymon/jwt-auth": "^1.0@dev", "iatstuti/laravel-cascade-soft-deletes": "1.0.*", "fish/eloquent-logger": "^1.0", "barryvdh/laravel-cors": "^0.8.2", "dingo/api": "1.0.x@dev" },

bootstrap/app.php
$app->register(Dingo\Api\Provider\LumenServiceProvider::class);

.env (its loaded.)
API_DEBUG=true API_PREFIX=api

config/api.php
'prefix' => env('API_PREFIX', 'api'),

routes/web.php
`$api = app('Dingo\Api\Routing\Router');
$api->version('v1', ['middleware' => 'cors', 'namespace' => 'App\Http\Controllers', 'prefix' => 'api'], function ($api) {
/**
* Public routes
*/
$api->get('environmentInfo', 'ApiController@environmentInfo');

/**
 * Auth protected routes (JWT)
 */
$api->group(['middleware' => 'api.auth'], function ($api) {
    //User related
    $api->get('/authenticate/user', 'AuthController@getAuthenticatedUser');
    $api->post('/logout', 'AuthController@logout');
});

/**
 * Auth protected and language dependent routes
 */
$api->group(['middleware' => ['api.auth'], 'prefix' => 'languages/{language_id}'], function ($api) {
    //Glossaries
    $api->get('glossaries', ['uses' => 'GlossaryController@index']);

});`

Most helpful comment

Had the same issue, changed
'prefix' => env('API_PREFIX', null),
to
'prefix' => env('API_PREFIX', 'api'),

All 11 comments

go to /config/api.php
find line ~60
and follow documentation:

A prefix or subdomain is required, but only one.

That did not help. Closing the issue as I'm not using the package

This might be related to this issue:
https://github.com/laravel/framework/issues/7354

have a same issue

I have the same issue but i don't see any solution here so...
{Unable to boot ApiServiceProvider, configure an API domain or prefix.}

As the error suggests, you need to set the API_DOMAIN or API_PREFIX in the .env file

I usually use API_DOMAIN

@specialtactics read the whole thread before commenting.

Solved !
php artisan chache:clear
php artisan config:cache
This worked for me. Hope for you too!
Thnx !

@fureszk Just because you had a specific problem doesn't mean everyone else does, and as above, clearly it's fixed.

Had the same issue, changed
'prefix' => env('API_PREFIX', null),
to
'prefix' => env('API_PREFIX', 'api'),

@specialtactics thx

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sukh-gill picture sukh-gill  路  3Comments

jhayiwg picture jhayiwg  路  3Comments

yanguanglan picture yanguanglan  路  3Comments

MicroDroid picture MicroDroid  路  3Comments

jdforsythe picture jdforsythe  路  3Comments