Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it trows an error on startup #15

Closed
talamaska opened this issue Dec 11, 2015 · 7 comments
Closed

it trows an error on startup #15

talamaska opened this issue Dec 11, 2015 · 7 comments

Comments

@talamaska
Copy link

The bootstrap function threw an error after its callback was called :: TypeError: Invalid attempt to destructure non-iterable instance
    at server-location\node_modules\sails-swagger\dist\lib\xfmr.js:7:586
    at Object.getControllerFromRoute (server-location\node_modules\sails-swagger\dist\lib\xfmr.js:208:29)
    at Object.getPathTags (server-location\node_modules\sails-swagger\dist\lib\xfmr.js:178:183)
    at Object.getOperation (server-location\node_modules\sails-swagger\dist\lib\xfmr.js:169:25)
    at server-location\node_modules\sails-swagger\dist\lib\xfmr.js:155:26
    at server-location\node_modules\lodash\index.js:3395:24
    at server-location\node_modules\lodash\index.js:3073:15
    at baseForOwn (server-location\node_modules\lodash\index.js:2046:14)
    at Function.mapValues (server-location\node_modules\lodash\index.js:3394:9)
    at Object.getPathItem (server-location\node_modules\sails-swagger\dist\lib\xfmr.js:154:32)
    at server-location\node_modules\sails-swagger\dist\lib\xfmr.js:113:26
    at server-location\node_modules\lodash\index.js:3395:24
    at server-location\node_modules\lodash\index.js:3073:15
    at baseForOwn (server-location\node_modules\lodash\index.js:2046:14)
    at Function.mapValues (server-location\node_modules\lodash\index.js:3394:9)
    at Object.getPaths (server-location\node_modules\sails-swagger\dist\lib\xfmr.js:112:32) [TypeError: Invalid attempt to destructure non-iterable instance]

What I'm doing wrong?

@zontafil
Copy link

similar problem:

  error: The bootstrap function threw an error after its callback was called :: ReferenceError: Symbol is not defined
      at Object.getPathControllerTag (/home/dati/Sorgenti/Node/d/node_modules/sails-swagger/dist/lib/xfmr.js:226:51)
      at Object.getPathTags (/home/dati/Sorgenti/Node/d/node_modules/sails-swagger/dist/lib/xfmr.js:211:129)
      at Object.getOperation (/home/dati/Sorgenti/Node/d/node_modules/sails-swagger/dist/lib/xfmr.js:200:25)
      at /home/dati/Sorgenti/Node/d/node_modules/sails-swagger/dist/lib/xfmr.js:186:26
      at /home/dati/Sorgenti/Node/d/node_modules/sails-swagger/node_modules/lodash/index.js:3395:24
      at /home/dati/Sorgenti/Node/d/node_modules/sails-swagger/node_modules/lodash/index.js:3073:15
      at baseForOwn (/home/dati/Sorgenti/Node/d/node_modules/sails-swagger/node_modules/lodash/index.js:2046:14)
      at Function.mapValues (/home/dati/Sorgenti/Node/d/node_modules/sails-swagger/node_modules/lodash/index.js:3394:9)
      at Object.getPathItem (/home/dati/Sorgenti/Node/d/node_modules/sails-swagger/dist/lib/xfmr.js:185:32)
      at /home/dati/Sorgenti/Node/d/node_modules/sails-swagger/dist/lib/xfmr.js:142:26
      at /home/dati/Sorgenti/Node/d/node_modules/sails-swagger/node_modules/lodash/index.js:3395:24
      at /home/dati/Sorgenti/Node/d/node_modules/sails-swagger/node_modules/lodash/index.js:3073:15
      at baseForOwn (/home/dati/Sorgenti/Node/d/node_modules/sails-swagger/node_modules/lodash/index.js:2046:14)
      at Function.mapValues (/home/dati/Sorgenti/Node/d/node_modules/sails-swagger/node_modules/lodash/index.js:3394:9)
      at Object.getPaths (/home/dati/Sorgenti/Node/d/node_modules/sails-swagger/dist/lib/xfmr.js:141:32)
      at Object.getSwagger (/home/dati/Sorgenti/Node/d/node_modules/sails-swagger/dist/lib/xfmr.js:66:26)
      at /home/dati/Sorgenti/Node/d/node_modules/sails-swagger/dist/api/hooks/swagger/index.js:77:41
      at /home/dati/Sorgenti/Node/d/node_modules/sails/lib/app/private/after.js:91:14
      at /home/dati/Sorgenti/Node/d/node_modules/sails/node_modules/async/lib/async.js:251:17
      at done (/home/dati/Sorgenti/Node/d/node_modules/sails/node_modules/async/lib/async.js:132:19)
      at /home/dati/Sorgenti/Node/d/node_modules/sails/node_modules/async/lib/async.js:32:16
      at /home/dati/Sorgenti/Node/d/node_modules/sails/node_modules/async/lib/async.js:248:21 [ReferenceError: Symbol is not defined]

@zuker
Copy link

zuker commented Dec 30, 2015

This happens when controller property in route config don't match pattern here https://github.com/tjwebb/sails-swagger/blob/v0.5.1/lib/xfmr.js#L188.

@talamaska
Copy link
Author

Well, so we must name our controllers properly. But interesting is on https://github.com/tjwebb/sails-swagger/blob/v0.5.1/lib/xfmr.js#L193 that this pattern variable is never used.

@zuker
Copy link

zuker commented Dec 30, 2015

Yes, variable pattern is never used, but the same pattern /(.+)Controller/ is used here: https://github.com/tjwebb/sails-swagger/blob/v0.5.1/lib/xfmr.js#L193

@talamaska
Copy link
Author

You're right but this logic doesn't correspond to the Sails docs about custom routes
http://sailsjs.org/documentation/concepts/routes/custom-routes

'GET /foo/go': 'FooController.myGoAction',
'GET /foo/go': 'Foo.myGoAction',
'GET /foo/go': {controller: "Foo", action: "myGoAction"},
'GET /foo/go': {controller: "FooController", action:"myGoAction"},

so this plugin will detect only the last route?

@zuker
Copy link

zuker commented Dec 30, 2015

It seems that yes: only controllers specified by globalId (i.e. controller: "FooController") in route configuration are detected properly.

@thibaultboursier
Copy link

Same problem, I had to add "Controller" suffix on controller property to make it working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants