Api: "Unable to boot ApiServiceProvider, configure an API domain or prefix" with API_PREFIX defined

Created on 20 Jun 2016  Â·  10Comments  Â·  Source: dingo/api

Hi, i got this error in production server

RuntimeException in DingoServiceProvider.php line 82:
Unable to boot ApiServiceProvider, configure an API domain or prefix.

but in my .env file API_PREFIX is defined.

API_PREFIX=api

I can check my env variable within tinker

$ php artisan tinker
Psy Shell v0.7.2 (PHP 5.6.21-1~dotdeb+7.1 — cli) by Justin Hileman
>>> env('API_PREFIX', null)
=> "api"
>>> exit
Exit:  Goodbye.

And it is OK, but my app still doesnt work. Can someone help? Thx ;)

Most helpful comment

I had the same problem when using a boilerplate template from
https://github.com/francescomalatesta/laravel-api-boilerplate-jwt

Resolved it by updating my config/api.php file, changing line 60 from
'prefix' => env('API_PREFIX', null),

to
'prefix' => env('API_PREFIX', 'api'),

All 10 comments

Hm, can't think of why you're getting this error if you've got it defined. Have you published/modified the API configuration file at all?

API configuration is published. Not modified.

I had the same problem when using a boilerplate template from
https://github.com/francescomalatesta/laravel-api-boilerplate-jwt

Resolved it by updating my config/api.php file, changing line 60 from
'prefix' => env('API_PREFIX', null),

to
'prefix' => env('API_PREFIX', 'api'),

That means your environment is not being set properly and using the default value you just set

Just installed, upgraded everything, composer update etc. and had the same problem.
@barrelmonkey 's fix worked. Despite having the variable set in the .env file....

Sorry, API_PREFIX wasn't setup in my .env file.

Can anyone help me by providing tutorial for making restful api from scratch. I also tried the below posted code for getting data from android and saving to database but didn't work. I have been stuck in this since 3 days please somebody help.
http://stackoverflow.com/questions/42853803/saving-json-data-in-database-posted-from-android-in-laravel?noredirect=1#comment72816469_42853803

'prefix' => env('API_PREFIX', 'api'),

Am still experiencing this issue someone with a working solution kindly help..have been stuck for hours

@254-Ninja If you are still having an issues on an up to date version of the package, please make a new support ticket using the new template.

Was this page helpful?
0 / 5 - 0 ratings