Unable to create new API using Dashboard

Imported Google Group message. Original thread at: https://groups.google.com/forum/#!topic/tyk-community-support/mGZYcy0XUoY Import Date: 2016-01-19 21:29:42 +0000.
Sender:Tomislav Pasalic.
Date:Monday, 16 March 2015 13:54:32 UTC.

Hi,

For my evaluation of Tyk I have set up Tyk API Gateway and Tyk Dashboard using pretty much the default settings. I have only one server with Redis and Mongo running locally. I am running everything on CentOS 6.5.

At one point I was able to import sample application based on app_sample.json using Tyk Dashboard: “Import API” -> “From Tyk Definition”. I was able to see hits on this API from the Tyk Gateway in the Tyk Dashboard.

Then I moved on to installation of host manager and when I was done with that I noticed that I cannot load API definitions through dashboard. Even stopping the host manager didn’t help. I know that JSON API definition is correct because when I set “use_db_app_configs” to false Tyk manages to load the API definition and API itself works fine. I have attached the sample API am trying load as app_sample.json. I am also attaching my tyk.conf and tyk-analytics.conf that I am using.

The error I see in the Dashboard log is attached as tyk_dashboard.log

This error is thrown by the Dashboard regardless if I try creating new API by importing API definition or by using “Add new API”.

I would appreciate any help you can provide.

Regards,
Tomislav.

Imported Google Group message.
Sender:Tomislav Pasalic.
Date:Monday, 16 March 2015 17:50:29 UTC.

Hi Martin,

This was a good hint. I have figured out what was the problem. I have created a symlink to tyk-analytics in the /usr/local/bin and I was running it from there and passing the path to the configuration file as parameter in the command line. Tyk analytics config and all the other files were located at some other location so it seems that it failed to load the files it needed. I have now copied the full tyk-analytics directory to the /etc/tyk-analytics and now it all works fine.

Thanks a lot for your help in troubleshooting this!

Regards,
Tomislav.

  • show quoted text -

Imported Google Group message.
Sender:Martin Buhr.
Date:Monday, 16 March 2015 15:03:35 UTC.

Hi Tomislav,

Interesting, it looks like you are trying to view the APIs in the system and it is giving you the error - this implies that there is something wrong with one or more of the defintions that have entered into MongoDB, which could potentially have happened when you imported the definitions (although it shouldn’t).

The Host manager shouldn’t be causing any issues as it doesn’t ever write to the DB.

Could you post the contents of the tyk_apis collection in your DB?

Thanks,
Martin

  • show quoted text -

Imported Google Group message.
Sender:Martin Buhr.
Date:Monday, 16 March 2015 16:11:23 UTC.

Hi Martin,

Thanks for the prompt reply. In the mean time I have deleted the previously registered API in attempt to figure out what was wrong and if the existing API was causing the issue. It didn’t help and now I don’t have any APIs registered and so I don’t even have the tyk_apis collection any more. I have only following collections in the tyk_analytics DB:

show collections
system.indexes
tyk_analytics
tyk_analytics_users
tyk_organisations

I even tried with stopped Tyk but no luck. Also, as additional information, I am using the latest version of dashboard: 0.9.3.

Regards,
Tomislav.

  • show quoted text -

Imported Google Group message.
Sender:Tomislav Pasalic.
Date:Monday, 16 March 2015 16:44:41 UTC.

Hi Tomislav,

So with no Apis defined your dashboard application is still raising the panic? Are the logs the same when you view the Api page?

Can you post the contents of the organisations collection?

Finally, can you also post the contents of the schemes folder?

Cheers,
Martin

  • show quoted text -

  • show quoted text -


You received this message because you are subscribed to the Google Groups “Tyk Community Support” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web, visit https://groups.google.com/d/msgid/tyk-community-support/be269acb-38f1-4337-9322-5748a340ef8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Imported Google Group message.
Sender:Martin Buhr.
Date:Monday, 16 March 2015 17:00:17 UTC.

Hi Martin,

I get the Panic raised only when I attempt to add a new API definition. There is no error when I just navigate to the Apis screen. When I attempt adding the API the error in the log always looks the same.

Mongo DB collections:
[[email protected] ~]$ mongo
MongoDB shell version: 3.0.0
connecting to: test

show dbs
local 0.078GB
tyk_analytics 0.078GB
use tyk_analytics
switched to db tyk_analytics
show collections
system.indexes
tyk_analytics
tyk_analytics_users
tyk_organisations
db.tyk_organisations.find()
{ “_id” : ObjectId(“550322ebe138230e99000001”), “owner_name” : “atg”, “apis” : [ ], “key_quota” : 0 }
db.tyk_analytics_users.find()
{ “_id” : ObjectId(“55032320879409029f1d023f”), “firstname” : “Tomislav”, “lastname” : “Pasalic”, “emailaddress” : "[email protected]", “password” : “$2a$10$DYyKcBRvpyjibPFYPS.EQOqKywdh9KHcqKyd3wmNWXG.o5.UVnwMi”, “orgid” : “550322ebe138230e99000001”, “active” : true, “accesskey” : “48fd8b0e0a69439969a923664ff5eddd” }

Schemes dir contents:
[[email protected] ~]$ cd /etc/tyk-analytics/schemas/
[[email protected] schemas]$ ls -alF
total 40
drwx------. 2 tyk tyk 4096 Feb 11 12:26 ./
drwxr-xr-x. 4 tyk tyk 4096 Mar 16 08:38 …/
-rw-r–r--. 1 tyk tyk 5730 Feb 12 04:03 api_definition.json
-rw-r–r--. 1 tyk tyk 3013 Feb 12 04:03 basic_auth.json
-rw-------. 1 tyk tyk 1925 Feb 12 04:03 key_data.json
-rw-------. 1 tyk tyk 200 Feb 12 04:03 oauth_app_request.json
-rw-------. 1 tyk tyk 619 Feb 12 04:03 user.json
-rw-------. 1 tyk tyk 229 Feb 12 04:03 user_password.json
-rw-r–r--. 1 tyk tyk 462 Feb 12 04:03 webhook.json

All processes (tyk, tyk-analytics and tyk-host-manager) are configured under /etc/init.d as services and are configured to run at startup under root user.

I have all this running in a Oracle VirtualBox VM but compressed VM is about 1GB so I am not sure if it is feasible to send that over to you.

Regards,
Tomislav.

  • show quoted text -

Imported Google Group message.
Sender:Tomislav Pasalic.
Date:Monday, 16 March 2015 17:13:42 UTC.

Hi,

Where is the binary? It looks for all files relative to itself, so it needs to be run with pwd set to the directory where the binary is.

Thanks,
Martin

On Monday, March 16, 2015, Tomislav Pasalic [email protected] wrote:
Hi Martin,

I get the Panic raised only when I attempt to add a new API definition. There is no error when I just navigate to the Apis screen. When I attempt adding the API the error in the log always looks the same.

Mongo DB collections:
[[email protected] ~]$ mongo
MongoDB shell version: 3.0.0
connecting to: test

show dbs
local 0.078GB
tyk_analytics 0.078GB
use tyk_analytics
switched to db tyk_analytics
show collections
system.indexes
tyk_analytics
tyk_analytics_users
tyk_organisations
db.tyk_organisations.find()
{ “_id” : ObjectId(“550322ebe138230e99000001”), “owner_name” : “atg”, “apis” : [ ], “key_quota” : 0 }
db.tyk_analytics_users.find()
{ “_id” : ObjectId(“55032320879409029f1d023f”), “firstname” : “Tomislav”, “lastname” : “Pasalic”, “emailaddress” : "[email protected]", “password” : “$2a$10$DYyKcBRvpyjibPFYPS.EQOqKywdh9KHcqKyd3wmNWXG.o5.UVnwMi”, “orgid” : “550322ebe138230e99000001”, “active” : true, “accesskey” : “48fd8b0e0a69439969a923664ff5eddd” }

  • show quoted text -

  • show quoted text -

To view this discussion on the web, visit https://groups.google.com/d/msgid/tyk-community-support/06feb6ce-69dd-4649-a1b6-40bb6886293e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Imported Google Group message.
Sender:Martin Buhr.
Date:Monday, 16 March 2015 17:50:29 UTC.

Hi Martin,

This was a good hint. I have figured out what was the problem. I have created a symlink to tyk-analytics in the /usr/local/bin and I was running it from there and passing the path to the configuration file as parameter in the command line. Tyk analytics config and all the other files were located at some other location so it seems that it failed to load the files it needed. I have now copied the full tyk-analytics directory to the /etc/tyk-analytics and now it all works fine.

Thanks a lot for your help in troubleshooting this!

Regards,
Tomislav.

  • show quoted text -

Imported Google Group message.
Sender:Tomislav Pasalic.
Date:Wednesday, 4 November 2015 15:11:58 UTC.

HI. Can you help me? I need to create an init.d script for tyk.

Thanks

  • show quoted text -