apigee-127 / magic

Where the magic happens
Other
4 stars 5 forks source link

problem with latest version of swagger-tools/json-refs #18

Closed antxxxx closed 8 years ago

antxxxx commented 8 years ago

Not sure if the problem is in this code, or downstream in swagger-tools or json refs, but...

swagger-tools has been updated to version 0.9.14 which uses the latest version of json-refs - 2.1.5

This module specifies to use ^0.9.0 of swagger-tools so if you do a clean install it gets version 0.9.14 of swagger-tools and version 2.1.5 of json-refs

If you deploy a proxy to apigee edge with these versions, you get this errors when you try to call it

TypeError: Expected argument of type object, but instead had type object at clone (/organization/environment/api/node_modules/a127-magic/node_modules/swagger-tools/node_modules/json-refs/index.js:69) at /organization/environment/api/node_modules/a127-magic/node_modules/swagger-tools/node_modules/json-refs/index.js:70 at clone (/organization/environment/api/node_modules/a127-magic/node_modules/swagger-tools/node_modules/json-refs/index.js:69) at /organization/environment/api/node_modules/a127-magic/node_modules/swagger-tools/node_modules/json-refs/index.js:1165 at notifyIsolated (/organization/environment/api/node_modules/a127-magic/node_modules/swagger-tools/node_modules/json-refs/node_modules/native-promise-only/lib/npo.src.js:120) at notify (/organization/environment/api/node_modules/a127-magic/node_modules/swagger-tools/node_modules/json-refs/node_modules/native-promise-only/lib/npo.src.js:97) at drain (/organization/environment/api/node_modules/a127-magic/node_modules/swagger-tools/node_modules/json-refs/node_modules/native-promise-only/lib/npo.src.js:67) at processImmediate (timers.js:345)

whitlockjc commented 8 years ago

That error is somewhat cryptic in it says the argument should be an object but it found an object. I think this could be a Trireme thing so I'm going to point you to a blog post published yesterday on a utility we wrote to help diagnose these things outside of Apigee Edge: http://apigee.com/about/blog/developer/developing-nodejs-apigee-edge Use the information that blog to use the Apigee Edge Like Launcher for Node.js to see if you can reproduce this outside of Apigee Edge.

I'm assuming this runs fine with Node.js?

antxxxx commented 8 years ago

Yeah - it runs fine using node.js (version 0.10.32) but does fail when running locally using trireme.

In case anybody else does come across this, a workaround is to force usage of swagger-tools version 0.9.11 by putting a reference to that in the main package.json of the node app you want to run on Apigee

antxxxx commented 8 years ago

I have managed to track this down to an entry in our swagger.yaml file. If we have an empty value in there, then it fails in triereme. If we just remove the empty value, then it works

So we have a line with

x-a127-config:

then it fails. Removing these allows it to work running under node and trireme

antxxxx commented 8 years ago

Have also created issue on trireme https://github.com/apigee/trireme/issues/146

whitlockjc commented 8 years ago

Thanks for chasing this down. I do think this is a Trireme bug so unless you object, we can close it here because there's nothing to be done here.

antxxxx commented 8 years ago

Thats fine - will close it