Apiato: User registration endpoint throws BadMethodCallException

Created on 12 Aug 2017  路  3Comments  路  Source: apiato/apiato

Expected Behavior

A successful response after hitting user registration endpoint.

Actual Behavior

It throws BadMethodCallException
{"errors":"Oops something went wrong.","status_code":400,"message":"Call to undefined method Illuminate\\Database\\Query\\Builder::getResourceKey()","exception":"BadMethodCallException","trace":"[{\"file\":\"\\\/home\\\/vagrant\\\/Sites\\\/dev\\\/apiato\\\/vendor\\\/laravel\\\/framework\\\/src\\\/Illuminate\\\/Database\\\/Eloquent\\\/Builder.php\",\"line\":1254,\"function\":\"__call\",\"class\":\"Illuminate\\\\Database\\\\Query\\\\Builder\",\"type\":\"->\",\"args\":[\"getResourceKey\",[]]},{\"file\":\"\\\/home\\\/vagrant\\\/Sites\\\/dev\\\/apiato\\\/vendor\\\/laravel\\\/framework\\\/src\\\/Illuminate\\\/Database\\\/Eloquent\\\/Model.php\",\"line\":1372,\"function\":\"__call\",\"class\":\"Illuminate\\\\Database\\\\Eloquent\\\\Builder\",\"type\":\"->\",\"args\":[\"getResourceKey\",[]]},{\"file\":\"\\\/home\\\/vagrant\\\/Sites\\\/dev\\\/apiato\\\/vendor\\\/apiato\\\/core\\\/Traits\\\/ResponseTrait.php\",\"line\":70,\"function\":\"__call\",\"class\":\"Illuminate\\\\Database\\\\Eloquent\\\\Model\",\"type\":\"->\",\"args\":[\"getResourceKey\",[]]},{\"file\":\"\\\/home\\\/vagrant\\\/Sites\\\/dev\\\/apiato\\\/app\\\/Containers\\\/User\\\/UI\\\/API\\\/Controllers\\\/Controller.php\",\"line\":43,\"function\":\"transform\",\"class\":\"Apiato\\\\Core\\\\Abstracts\\\\Controllers\\\\ApiController\",\"type\":\"->\",\"args\":[{\"email\":\"[email protected]\",\"name\":\"JohnDoe\",\"gender\":null,\"birth\":null,\"is_client\":true,\"updated_at\":\"2017-08-12 07:22:45\",\"created_at\":\"2017-08-12 07:22:45\",\"id\":2},\"App\\\\Containers\\\\User\\\\UI\\\\API\\\\Transformers\\\\UserTransformer\"]},{\"function\":\"registerUser\",\"class\":\"App\\\\Containers\\\\User\\\\UI\\\\API\\\\Controllers\\\\Controller\",\"type\":\"->\",\"args\":[{\"attributes\":{},\"request\":{},\"query\":{},\"server\":{},\"files\":{},\"cookies\":{},\"headers\":{},\"stateKeeperStates\":[]}]},{\"file\":\"\\\/home\\\/vagrant\\\/Sites\\\/dev\\\/apiato\\\/vendor\\\/laravel\\\/framework\\\/src\\\/Illuminate\\\/Routing\\\/Controller.php\",\"line\":55,\"function\":\"call_user_func_array\",\"args\":[[{\"ui\":\"api\"},\"registerUser\"],[{\"attributes\":{},\"request\":{},\"query\":{},\"server\":{},\"files\":{},\"cookies\":{},\"headers\":{},\"stateKeeperStates\":[]}]]} ... yada yada yada

Steps to Reproduce the Problem

  1. Fresh installation of apiato using composer create-project apiato/apiato api
  2. Setup & migrate the database
  3. Hit the user registration endpoint curl -X POST -H "Accept: application/json" -H "Cache-Control: no-cache" -F "[email protected]" -F "password=so-secret" -F "name=Mahmoud Zalt" "http://api.apiato.dev/v1/register"

Specifications

  • Apiato Version: v5.0.0
  • Homestead Repo: v6.0.3
  • Homestead Box: v3.0.0

Additional Details

A row is actually inserted in users table but an exception is thrown afterward.

Most helpful comment

@jbaron-mx @FWidm Sorry about this, I missed creating new release x.x.* after upgrading the core package which caused this error.

Should work now after pulling Apiato 5.0.2

All 3 comments

Same problem here.

Expected Behavior

A successful response after hitting user registration endpoint.

Reproduction:

  1. composer create-project apiato/apiato api - pulls apiato 5.0.0

    • either in MAMP/htdocs or in any directory

  2. Setting up the environment

    • MAMP (4.2): setup MAMP, mysql and ports

    • Laradock: setup in api/laradock, copy env example in api/laradock/.env

  3. Edit api/.env for either of the options
  4. execute curl to register the user - output: curl, postman
    Same output for both local and laradock setup.

Additional Details:

  • row is inserted in the users table
  • phpunit also fails some tests on both installations:
    phpunit.txt

OS X 10.12.6

@jbaron-mx @FWidm Sorry about this, I missed creating new release x.x.* after upgrading the core package which caused this error.

Should work now after pulling Apiato 5.0.2

Thanks, works like a charm for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nmrgt picture nmrgt  路  7Comments

Mohammad-Alavi picture Mohammad-Alavi  路  3Comments

FWidm picture FWidm  路  3Comments

mvn-trungtran-dn picture mvn-trungtran-dn  路  6Comments

lukaszduda picture lukaszduda  路  5Comments