Cannot approve request key

Imported Google Group message. Original thread at: Redirecting to Google Groups Import Date: 2016-01-19 21:16:19 +0000.
Sender:michele danieli.
Date:Friday, 19 June 2015 21:01:37 UTC+1.

Hello,
i am having problems with key generation, maybe someone can help me. I have installed in vagrant Tyk 1.6 with Tyk Analytics 0.9.4.4. When I try to request a key or approve a request I get the following application error. I checked on mongo the request and have the result below (after the stack trace).

Any clue of what the problem may be? I cleaned up the DB manually and started all over, registering a new organization but the result did not change.

I am thinking about starting from scratch and reinstall everything.

========================= STACK TRACE OF TYK_ANALYTICS
ERROR 2015/06/19 15:26:59.006372 panic_handler.go:26: PANIC
URL: /api/portal/requests/approve/5584346856c02c0624000001
ERROR: Invalid input to ObjectIdHex: “”
STACK:
goroutine 51 [running]:
github.com/gocraft/web.(*Router).handlePanic(0xc208046160, 0xc20815c6c0, 0xc20815c6e0, 0x814a80, 0xc208179ce0)
/home/tyk/go/src/github.com/gocraft/web/router_serve.go:251 +0x37a
github.com/gocraft/web.func·001()
/home/tyk/go/src/github.com/gocraft/web/router_serve.go:43 +0x84
labix.org/v2/mgo/bson.ObjectIdHex(0xce6f68, 0x0, 0x0, 0x0)
/home/tyk/go/src/labix.org/v2/mgo/bson/bson.go:174 +0x207
main.(*KeyRequest).Generate(0xc2081c3570, 0x0, 0x0, 0x0, 0x0)
/home/tyk/go/src/github.com/lonelycode/tyk-analytics/PortalModelKeyRequest.go:76 +0x7cf
main.(*APIContext).PortalApproveKeyRequest(0xc208036970, 0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0)
/home/tyk/go/src/github.com/lonelycode/tyk-analytics/PortalAPIMethods.go:419 +0x31e
reflect.Value.call(0x876d00, 0xa9ad48, 0x13, 0x973470, 0x4, 0xc2081e8908, 0x3, 0x3, 0x0, 0x0, …)
/usr/local/go/src/reflect/value.go:419 +0x10e5
reflect.Value.Call(0x876d00, 0xa9ad48, 0x13, 0xc2081e8908, 0x3, 0x3, 0x0, 0x0, 0x0)
/usr/local/go/src/reflect/value.go:296 +0xbc
github.com/gocraft/web.func·002(0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0)
/home/tyk/go/src/github.com/gocraft/web/router_serve.go:113 +0xbc0
main.(*APIContext).ApiAuthorisationRequired(0xc208036970, 0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0, 0xc2081797b0)
/home/tyk/go/src/github.com/lonelycode/tyk-analytics/Main.go:327 +0x11d
reflect.Value.call(0x8a0d80, 0xa9ab80, 0x13, 0x973470, 0x4, 0xc2081e8e18, 0x4, 0x4, 0x0, 0x0, …)
/usr/local/go/src/reflect/value.go:419 +0x10e5
reflect.Value.Call(0x8a0d80, 0xa9ab80, 0x13, 0xc2081e8e18, 0x4, 0x4, 0x0, 0x0, 0x0)
/usr/local/go/src/reflect/value.go:296 +0xbc
github.com/gocraft/web.(*middlewareHandler).invoke(0xc208099470, 0x96e0e0, 0xc208036970, 0x16, 0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0, 0xc2081797b0)
/home/tyk/go/src/github.com/gocraft/web/router_serve.go:133 +0x2d5
github.com/gocraft/web.func·002(0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0)
/home/tyk/go/src/github.com/gocraft/web/router_serve.go:122 +0x1c8
github.com/gocraft/web.func·004(0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0, 0xc2081797b0)
/home/tyk/go/src/github.com/gocraft/web/static_middleware.go:23 +0x64a
github.com/gocraft/web.(*middlewareHandler).invoke(0xc2080c5bc0, 0x937c80, 0xc208036950, 0x16, 0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0, 0xc2081797b0)
/home/tyk/go/src/github.com/gocraft/web/router_serve.go:131 +0x71
github.com/gocraft/web.func·002(0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0)
/home/tyk/go/src/github.com/gocraft/web/router_serve.go:122 +0x1c8
github.com/gocraft/web.func·004(0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0, 0xc2081797b0)
/home/tyk/go/src/github.com/gocraft/web/static_middleware.go:23 +0x64a
github.com/gocraft/web.(*middlewareHandler).invoke(0xc2080c5b60, 0x937c80, 0xc208036950, 0x16, 0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0, 0xc2081797b0)
/home/tyk/go/src/github.com/gocraft/web/router_serve.go:131 +0x71
github.com/gocraft/web.func·002(0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0)
/home/tyk/go/src/github.com/gocraft/web/router_serve.go:122 +0x1c8
github.com/gocraft/web.LoggerMiddleware(0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0, 0xc2081797b0)
/home/tyk/go/src/github.com/gocraft/web/logger_middleware.go:16 +0x78
github.com/gocraft/web.(*middlewareHandler).invoke(0xc2080c5b30, 0x937c80, 0xc208036950, 0x16, 0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0, 0xc2081797b0)
/home/tyk/go/src/github.com/gocraft/web/router_serve.go:131 +0x71
github.com/gocraft/web.func·002(0x7f52baccee18, 0xc20815c6c0, 0xc20815c6e0)
/home/tyk/go/src/github.com/gocraft/web/router_serve.go:122 +0x1c8
github.com/gocraft/web.(*Router).ServeHTTP(0xc208046160, 0x7f52baccede0, 0xc20808f5e0, 0xc2080cb790)
/home/tyk/go/src/github.com/gocraft/web/router_serve.go:48 +0x3cf
net/http.serverHandler.ServeHTTP(0xc208042b40, 0x7f52baccede0, 0xc20808f5e0, 0xc2080cb790)
/usr/local/go/src/net/http/server.go:1703 +0x19a
net/http.(*conn).serve(0xc20808f360)
/usr/local/go/src/net/http/server.go:1204 +0xb57
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:1751 +0x35e

==================== MONGO DB QUERY ==========================

db.portal_key_requests.find()
{ “_id” : ObjectId(“5584346856c02c0624000001”), “org_id” : “558333a456c02c049f000001”, “for_api” : “4a9f881537394289654dd049cac68902”, “by_user” : “5583367f56c02c0533000001”, “fields” : { }, “approved” : false, “date_created” : ISODate(“2015-06-19T15:25:28.369Z”) }

Imported Google Group message.
Sender:Martin Buhr.
Date:Sunday, 21 June 2015 11:39:11 UTC+1.

Found the problem, Tyk can’t find the policy attached to the catalogue entry. You’ll need to define one and add it to the catalogue entry that key request is asking for.

We will need to add some error handling!

Thanks,
Martin

On Sun, Jun 21, 2015 at 3:08 AM -0700, “michele danieli” [email protected] wrote:

  • 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/dac6b939-58e9-4a5d-a2d3-14e08a8c7a27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Imported Google Group message.
Sender:.
Date:Friday, 19 June 2015 21:15:14 UTC+1.

Hi,
Nothing wrong there - I think there may be an issue with your request, or you’ve found a bug!
I would suggest going to the dashboard in a browser and watching the network in the developer console when you manually approve the request (you can approve a request multiple times it regenerates the key), it might just be a structural issue - it looks like the API isn’t picking up the key request ID which causes the error.
You could also try putting a slash at the end of the request…
If the dashboard can generate the key, then you can do it programmatically. If the dashboard can’t then there’s something seriously wrong…
Let me know how you get on, we’ll get to the bottom of it…
Thanks,
Martin

Imported Google Group message.
Sender:michele danieli.
Date:Sunday, 21 June 2015 11:08:07 UTC+1.

i have tried but I cannot approve the key if I generate the request and disable auto approve or generate the key with auto approve using the dashboard. Will try a clean install next week of the dashboard. 0.9.4.4 is latest correct?

  • show quoted text -

Imported Google Group message.
Sender:Martin Buhr.
Date:Sunday, 21 June 2015 11:35:15 UTC+1.

Hi,

Yes that is the correct version - you’ll need to probably start with a fresh database too if you manually edited it.

Let me know how it goes…

  • 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/dac6b939-58e9-4a5d-a2d3-14e08a8c7a27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Imported Google Group message.
Sender:michele danieli.
Date:Sunday, 21 June 2015 11:39:11 UTC+1.

Found the problem, Tyk can’t find the policy attached to the catalogue entry. You’ll need to define one and add it to the catalogue entry that key request is asking for.

We will need to add some error handling!

Thanks,
Martin

On Sun, Jun 21, 2015 at 3:08 AM -0700, “michele danieli” [email protected] wrote:

  • 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/dac6b939-58e9-4a5d-a2d3-14e08a8c7a27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.