loopback icon indicating copy to clipboard operation
loopback copied to clipboard

Simple example API broken in alpha.3

Open rogersnm opened this issue 10 years ago • 8 comments

The removal of the current-context API in alpha.3 appears to have broken something. This can be seen with a simple example app:

mkdir api
cd api
slc loopback

With options:

  • kind of application: api-server (A LoopBack API server with local User auth)
  • loopback version: 3.x

After install, running node . and executing GET /api/Users returns:

Unhandled error for request GET /api/Users: Error: remoting.context option was removed in version 3.0. See https://docs.strongloop.com/display/APIC/Using%20current%20context for more details.
    at restApiHandler (/Users/dev/api2/node_modules/loopback/server/middleware/rest.js:44:15)
    at Layer.handle [as handle_request] (/Users/dev/api2/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/dev/api2/node_modules/express/lib/router/index.js:312:13)
    at /Users/dev/api2/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/Users/dev/api2/node_modules/express/lib/router/index.js:330:12)
    at next (/Users/dev/api2/node_modules/express/lib/router/index.js:271:10)
    at /Users/dev/api2/node_modules/express/lib/router/index.js:618:15
    at next (/Users/dev/api2/node_modules/express/lib/router/index.js:256:14)
    at Function.handle (/Users/dev/api2/node_modules/express/lib/router/index.js:176:3)
    at router (/Users/dev/api2/node_modules/express/lib/router/index.js:46:12)
    at Layer.handle [as handle_request] (/Users/dev/api2/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/dev/api2/node_modules/express/lib/router/index.js:312:13)
    at /Users/dev/api2/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/Users/dev/api2/node_modules/express/lib/router/index.js:330:12)
    at next (/Users/dev/api2/node_modules/express/lib/router/index.js:271:10)
    at nosniff (/Users/dev/api2/node_modules/dont-sniff-mimetype/index.js:4:5)

on the first execution, subsequent executions then return:

Unhandled error for request GET /api/Users: Error: Cannot GET /api/Users
at raiseUrlNotFoundError (/Users/dev/api2/node_modules/loopback/server/middleware/url-not-found.js:20:17)
at Layer.handle [as handle_request] (/Users/dev/api2/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/dev/api2/node_modules/express/lib/router/index.js:312:13)
at /Users/dev/api2/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/Users/dev/api2/node_modules/express/lib/router/index.js:330:12)
at next (/Users/dev/api2/node_modules/express/lib/router/index.js:271:10)
at /Users/dev/api2/node_modules/async/dist/async.js:486:20
at replenish (/Users/dev/api2/node_modules/async/dist/async.js:879:29)
at /Users/dev/api2/node_modules/async/dist/async.js:888:13
at eachLimit$1 (/Users/dev/api2/node_modules/async/dist/async.js:3136:26)
at Object.<anonymous> (/Users/dev/api2/node_modules/async/dist/async.js:920:20)
at restApiHandler (/Users/dev/api2/node_modules/loopback/server/middleware/rest.js:63:11)
at Layer.handle [as handle_request] (/Users/dev/api2/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/dev/api2/node_modules/express/lib/router/index.js:312:13)
at /Users/dev/api2/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/Users/dev/api2/node_modules/express/lib/router/index.js:330:12)

Following the 3.0-RELEASE-NOTES and adding loopback-context does nothing to resolve the issue or change the behaviour. The same configuration with alpha.1 and alpha.2 works fine.

rogersnm avatar Aug 12 '16 09:08 rogersnm

The slc loopback installer also makes no note that 3.x is still in alpha.

hoxxep avatar Aug 12 '16 09:08 hoxxep

Should be fixed with latest [email protected] release. Could you please try again and let me know if it works for you? Thanks!

0candy avatar Aug 24 '16 20:08 0candy

Following the 3.0-RELEASE-NOTES and adding loopback-context does nothing to resolve the issue or change the behaviour. The same configuration with alpha.1 and alpha.2 works fine.

The instructions are here: https://docs.strongloop.com/display/APIC/Using+current+context#Usingcurrentcontext-Fixingdeprecationwarnings

I have opened a PR to add upgrading instructions to release notes, see https://github.com/strongloop/loopback/pull/2721

bajtos avatar Sep 06 '16 15:09 bajtos

I am closing this issue as fixed. @rogersnm feel free to reopen if the problem still persists.

bajtos avatar Sep 07 '16 11:09 bajtos

i am having same kind of issue when i open localhost i get Cannot GET / why is that

ghulamhussain avatar Apr 05 '17 07:04 ghulamhussain

btw i am converting a soap api to rest api

ghulamhussain avatar Apr 05 '17 07:04 ghulamhussain

i am also not able to connect to a magento wsdl all other wsdl work fine is there any solution

ghulamhussain avatar Apr 05 '17 07:04 ghulamhussain

@ghulamhussain thank you for the comment. Please open a new github issue and provide us with steps how to reproduce the problem you are experiencing - see http://loopback.io/doc/en/contrib/Reporting-issues.html#bug-report

bajtos avatar Apr 05 '17 13:04 bajtos