loopback icon indicating copy to clipboard operation
loopback copied to clipboard

Application cannot call 'findById' in AccessToken

Open medokin opened this issue 12 years ago • 9 comments

Application cannot find 'findById' in AccessToken.

Related disscusion: https://groups.google.com/forum/#!msg/loopbackjs/FpREfreuDoo/zVy_z2MbSTwJ

Steps to reproduce:

  1. Create new project
  2. Start
  3. Create user
  4. Login user
  5. Request user list or just try to log out
Error: Cannot call AccessToken.findById(). The findById method has not been setup. The   PersistedModel has not been correctly attached to a DataSource!
    at throwNotAttached (C:\dev\loopback-api\node_modules\loopback\lib\persisted-model.js:55:9)
    at Function.find [as findById] (C:\dev\loopback-api\node_modules\loopback\lib\persisted-model.js:135:3)
    at Function.AccessToken.findForRequest (C:\dev\loopback-api\node_modules\loopback\common\models\access-token.js:94:12)
    at C:\dev\loopback-api\node_modules\loopback\lib\middleware\token.js:53:16
    at C:\dev\loopback-api\node_modules\loopback\lib\middleware\rest.js:46:7
    at Layer.handle [as handle_request] (C:\dev\loopback-api\node_modules\loopback\node_modules\express\lib\router\layer.js:82:5)
    at trim_prefix (C:\dev\loopback-api\node_modules\loopback\node_modules\express\lib\router\index.js:270:13)
    at C:\dev\loopback-api\node_modules\loopback\node_modules\express\lib\router\index.js:237:9
    at Function.proto.process_params (C:\dev\loopback-api\node_modules\loopback\node_modules\express\lib\router\index.js:312:12)
    at C:\dev\loopback-api\node_modules\loopback\node_modules\express\lib\router\index.js:228:12

image

medokin avatar Nov 06 '14 11:11 medokin

Windows 7 64 bit?

raymondfeng avatar Nov 06 '14 16:11 raymondfeng

Yes, Win7 64bit. Strongloop 2.70 Node v0.10.24

medokin avatar Nov 07 '14 14:11 medokin

I was about to reproduce the issue and the fix is available for review. See the PR link above.

raymondfeng avatar Nov 08 '14 00:11 raymondfeng

Works fine after that change.

medokin avatar Nov 09 '14 19:11 medokin

It should be fixed by [email protected].

raymondfeng avatar Nov 10 '14 16:11 raymondfeng

I have same error with loopback 3.0

Unhandled error for request GET /api/Albums/3?access_token=mJIE9mwBpcuSrAii3zuDxfYAJHnDGBSXRghm3a5HHa9g9vLZHh02eGglQUlz13on: Error: Cannot call AccessToken.findById(). The findById method has not been setup. The PersistedModel has not been correctly attached to a DataSource!

yagobski avatar Dec 15 '16 13:12 yagobski

Facing this same issue on Windows 10. @yagobski, Did you find anything ?

thatbeardo avatar Apr 27 '18 11:04 thatbeardo

Facing the same issue on Mac OS Sierra 10.12.6. Please Help!

ndjathe-master avatar Jun 18 '18 09:06 ndjathe-master

Same Issue in mac

jersonjohn avatar Mar 18 '19 02:03 jersonjohn