serverless / serverless-openwhisk

Adds Apache OpenWhisk support to the Serverless Framework!
http://openwhisk.org/
MIT License
143 stars 46 forks source link

Deploying API Gateway definitions... 401 #61

Closed JohnCoding94 closed 7 years ago

JohnCoding94 commented 7 years ago

I am trying to deploy a basic function with an HTTP trigger, but it looks like my token is not recognized:

Serverless: Packaging service...
Serverless: Compiling Functions...
Serverless: Compiling API Gateway definitions...
Serverless: Compiling Rules...
Serverless: Compiling Triggers & Feeds...
Serverless: Deploying Functions...
Serverless: Deploying API Gateway definitions...

  Serverless Error ---------------------------------------

  Failed to deploy API Gateway route (home) due to error: POST https://openwhisk.ng.bluemix.net/api/v1/web/whisk.system/apimgmt/createApi.http Returned HTTP 502 (Bad Gateway) --> "API creation failure: Unable to obtain API(s) from the API Gateway (status code 401): {"error":{"statusCode":401,"message":"Unauthorized"}}"

Here are the commands i have exucuted (i copy/paste all values from my ~/.wskprops file):

export OW_AUTH=<my-key-here>
export OW_APIHOST=<my-api-host>
export OW_APIGW_ACCESS_TOKEN=<my-access-token>
serverless deploy

Do you know why?

I am using serverless-openwhisk@0.7.0 and serverless@1.15.3.

My serverless.yml is:

provider:
  name: openwhisk

functions:
  hello:
    name: ${opt:stage}-test
    environment:
      NODE_ENV: ${opt:stage}
    handler: handler.hello
    events:
      - http:
          method: get
          path: home

plugins:
  - serverless-openwhisk
jthomas commented 7 years ago

Hello @JohnCoding94. Thanks for the detailed bug report.

I'm also seeing this issue. Can you run wsk api list and tell me what happens? This is also failing for me which leads me to believe it's a bigger issue than the framework. I'll investigate.

mdeuser commented 7 years ago

Assuming the OW_APIHOST value was set to openwhisk.ng.bluemix.net, there was a backend API GW domain name change that resulted in the 401. A patch was applied; hopefully, that 401 failure is no longer appearing.

jthomas commented 7 years ago

Thanks for the update @mdeuser.

I cannot replicate the issue anymore. @johncoding94 can you confirm that has been fixed for you?

JohnCoding94 commented 7 years ago

I have just tested again the same way, and it works!

Thanks!

shivekkhurana commented 7 years ago

I'm having a similar issues, except I get an empty errors object, instead of 401.

I don't have the gw_access_token configured. How did you generate the API_GW_ACCESSTOKEN ?

jthomas commented 7 years ago

Hello @shivekkhurana, the API_GW_ACCESSTOKEN token can be generated by running wsk bluemix login. This will retrieve the API gateway authentication token and store it in ~/.wskprops.

shobhit921 commented 6 years ago

I am getting this error

Failed to deploy function (openwhisk-nodejs-dev-test) due to error: PUT https://api.eu-gb.bluemix.net/api/v1/namespaces/_/actions/openwhisk-nodejs-dev-test?overwrite=true Returned HTTP 404 (Not Found) --> "Response Missing Error Message."

subraich commented 6 years ago

Hi I am trying to deploy a function in IBM Cloud but getting below error. Could anyone please help me?

Failed to deploy function (my-first-service-dev-hello) due to error: PUT https://api.ng.bluemix.net/api/v1/namespaces/_/actions/my-first-service-dev-hello?overwrite=true Returned HTTP 404 (Not Found) --> "Response Missing Error Message."

I could figure out the issue. I was providing wrong APIHOST and AUTH value.

@shobhit921 - Double check APIHOST and AUTH values.