"Invalid Access Token(Expired)" Error when trying to create IBM OpenWhisk Actions API

474 views Asked by At

I have a few actions developed on IBM OpenWhisk (Now they call it IBM Cloud Functions) and I'm trying to create some REST API for my actions with the new Cloud Function CLI but I'm getting an Expired Token Error. This used to work fine with the deprecated IBM OpenWhisk CLI but the problem started since I upgraded to Cloud Function CLI. Any suggestion would be welcomed, thanks

I do it in my script like this:

bx login -a $OPENWHISK_UK -o $OPENWHISK_ORG -s $OPENWHISK_SPACE -u $OPENWHISK_USER_NAME -p $OPENWHISK_PASSWORD

bx wsk package create pubsub \
        --param "CLOUDANT_USERNAME" $CLOUDANT_USERNAME \
        --param "CLOUDANT_PASSWORD" $CLOUDANT_PASSWORD

bx wsk action create pubsub/unsubscribe actions/unsubscribe.js --web true

bx wsk api create -n "Unsubscribe" /pubsub /unsubscribe post pubsub/unsubscribe --response-type json

And I get the following error:

Unable to create API: API creation failure: Unable to obtain API(s) from the API Gateway (status code 400): {"error":{"statusCode":400,"message":"Invalid access token (expired): eyJhbGc....Dw expired at Fri Sep 01 12:02:42 UTC 2017"}}
1

There are 1 answers

0
csantanapr On BEST ANSWER

Try upgrading to latest version of the bx wsk plugin at least version 1.0.2

To check current version use bx plugin list like this:

bx plugins list | grep Functions
Cloud-Functions      1.0.2

To update use bx plugin update like this:

bx plugin update cloud-functions