ibm-bluemix-mobile-services / bms-mca-token-validation-strategy

Apache License 2.0
1 stars 0 forks source link

Can't get serverUrl from VCAP_SERVICES #10

Closed jeanabraham closed 7 years ago

jeanabraham commented 7 years ago

Hi,

I created an Bluemix app using the MobileFirst Services Starter boilerplate. I was running into the below error. It is unable to find 'serverUrl' in VCAP_SERVICES.

2017-03-27T22:12:32.13-0400 [CELL/0]     OUT Creating container
2017-03-27T22:12:57.32-0400 [CELL/0]     OUT Successfully created container
2017-03-27T22:13:03.21-0400 [CELL/0]     OUT Starting health monitoring of container
2017-03-27T22:13:04.50-0400 [APP/0]      OUT > node .
2017-03-27T22:13:04.61-0400 [APP/0]      OUT packageVersion :: 1.0.0
2017-03-27T22:13:08.47-0400 [APP/0]      OUT bms-mca-token-validation-strategy initialized :: v2.0.9
2017-03-27T22:13:08.70-0400 [APP/0]      OUT [2017-03-28 02:13:08.699] [ERROR] [default] - Can't get serverUrl from VCAP_SERVICES, please check if the application running on bluemix or bind with IBM MobileFirst Platform service.
2017-03-27T22:13:08.70-0400 [APP/0]      ERR /home/vcap/app/node_modules/bms-mca-token-validation-strategy/lib/imf-backend-strategy.js:35
2017-03-27T22:13:08.70-0400 [APP/0]      ERR        throw new TypeError(msg);
2017-03-27T22:13:08.70-0400 [APP/0]      ERR     at new Strategy (/home/vcap/app/node_modules/bms-mca-token-validation-strategy/lib/imf-backend-strategy.js:35:9)
2017-03-27T22:13:08.70-0400 [APP/0]      ERR     at Object.Module._extensions..js (module.js:478:10)
2017-03-27T22:13:08.70-0400 [APP/0]      ERR     at Module.load (module.js:355:32)
2017-03-27T22:13:08.70-0400 [APP/0]      ERR     at node.js:814:3
2017-03-27T22:13:08.80-0400 [APP/0]      ERR npm ERR! node v0.12.18
2017-03-27T22:13:08.80-0400 [APP/0]      ERR npm ERR! npm  v2.15.11
2017-03-27T22:13:08.80-0400 [APP/0]      ERR npm ERR! code ELIFECYCLE
2017-03-27T22:13:08.80-0400 [APP/0]      ERR npm ERR! HelloTodo@1.0.0 start: `node .`
2017-03-27T22:13:08.80-0400 [APP/0]      ERR npm ERR! 
2017-03-27T22:13:08.80-0400 [APP/0]      ERR npm ERR! Failed at the HelloTodo@1.0.0 start script 'node .'.
2017-03-27T22:13:08.80-0400 [APP/0]      ERR npm ERR! You can get information on how to open an issue for this project with:
2017-03-27T22:13:08.80-0400 [APP/0]      ERR npm ERR! Or if that isn't available, you can get their info via:
2017-03-27T22:13:08.80-0400 [APP/0]      ERR npm ERR! Please include the following file with any support request:
2017-03-27T22:13:08.82-0400 [APP/0]      OUT Exit status 1
2017-03-27T22:13:08.89-0400 [CELL/0]     OUT Destroying container
2017-03-27T22:13:08.91-0400 [API/2]      OUT App instance exited with guid 3fba7535-d54b-48fc-bc9f-888cd4275756 payload: {"instance"=>"", "index"=>0, "reason"=>"CRASHED", "exit_description"=>"2 error(s) occurred:\n\n* 2 error(s) occurred:\n\n* Exited with status 1\n* cancelled\n* cancelled", "crash_count"=>4, "crash_timestamp"=>1490667188885877718, "version"=>"cf25af87-0eb2-4ae5-8e52-4ef274506211"}
2017-03-27T22:14:21.01-0400 [CELL/0]     OUT Creating container

But I don't see 'serverUrl' under the imfpush section of VCAP_SERVICES, only 'url'.

"imfpush": [
        {
            "credentials": {
                "appGuid": "37d....",
                "url": "http://imfpush.ng.bluemix.net/imfpush/v1/apps/37d......",
                "admin_url": "//mobile.ng.bluemix.net/imfpushdashbo......",
                "appSecret": "......",
                "clientSecret": "....."
            },

Is this a bug? Thanks!

Jean

jeanabraham commented 7 years ago

Nor is 'serverUrl' in AdvancedMobileAccess:

"AdvancedMobileAccess": [
        {
            "credentials": {
                "version": 3,
                "clientId": ".....",
                "secret": ".....",
                "tenantId": "....",
                "oauthServerUrl": ".....",
                "profilesUrl": "....."
            },
vitalymibm commented 7 years ago

If you are using App ID service instance (e.g it's a new instance created after Mar 16) please work with the new strategies: https://github.com/ibm-cloud-security/appid-serversdk-nodejs

The boilerplate has not been updated yet.