scope icon indicating copy to clipboard operation
scope copied to clipboard

[question] invoke setup function gives Bad credentials error

Open quantuminformation opened this issue 8 years ago • 14 comments

I tried to run the setup function, do I need to create an API token?

image

backend git:(master) ✗ sil setup

  Error --------------------------------------------------

     Server responded with status code 401:
{"message":"Bad
     credentials","documentation_url":"https://developer.github.com/v3"}

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues

     Please report this error. We think it might be a bug.

  Your Environment Information -----------------------------
     OS:                 darwin
     Node Version:       6.9.1
     Serverless Version: 1.7.0

quantuminformation avatar Feb 23 '17 19:02 quantuminformation

See https://www.youtube.com/watch?v=dbfTNYgWIuI

DavidWells avatar Feb 23 '17 20:02 DavidWells

and https://github.com/blog/1509-personal-api-tokens

On Thu, Feb 23, 2017 at 11:13 AM, Nikos [email protected] wrote:

I tried to run the setup function, do I need to create an API token?

[image: image] https://cloud.githubusercontent.com/assets/216566/23274848/2415e174-f9fc-11e6-93b7-663e1adfe702.png

backend git:(master) ✗ sil setup

Error --------------------------------------------------

 Server responded with status code 401:

{"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues

 Please report this error. We think it might be a bug.

Your Environment Information ----------------------------- OS: darwin Node Version: 6.9.1 Serverless Version: 1.7.0

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/serverless/scope/issues/10, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgfMDWCkZrJQLf-bwQynS1fW_McpRwWks5rfdpfgaJpZM4MKYE8 .

DavidWells avatar Feb 23 '17 20:02 DavidWells

Cool, do I just tick the repo ones?

image

quantuminformation avatar Feb 23 '17 22:02 quantuminformation

This project only needs read access for repos (not write).

But it doesn't really matter as long as your token is secure and not public for folks to find. Aka don't commit the API token to github =)

DavidWells avatar Feb 23 '17 23:02 DavidWells

I updated my local key and re-ran but get the same error with the above creds:

image

quantuminformation avatar Feb 23 '17 23:02 quantuminformation

I added a whole bunch of new permissions and got the same error. it will be easier when we can debug local lambda functions

quantuminformation avatar Feb 23 '17 23:02 quantuminformation

What is the sil setup command you are running?

Try debugging your Github API call with PostMan. Plug in a GET api endpoint and add in your username and auth token like so

image

It looks like your auth token from github is incorrect

DavidWells avatar Feb 24 '17 01:02 DavidWells

Also run sls logs -f setup -t to tail your logs to see any error coming back from the lambda function

DavidWells avatar Feb 24 '17 01:02 DavidWells

sil = serverless invoke local -f

Postman works fine: image

Running sls logs -f setup -t gives: image

quantuminformation avatar Feb 24 '17 11:02 quantuminformation

Oh you are invoking setup locally

That won't work run the setup function not locally

sly invoke -f setup`

On Feb 24, 2017, at 3:12 AM, Nikos [email protected] wrote:

sil = serverless invoke local -f

Postman works fine:

Running sls logs -f setup -t gives:

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

DavidWells avatar Feb 24 '17 17:02 DavidWells

tried that and got

image

quantuminformation avatar Feb 25 '17 16:02 quantuminformation

:)

Missing dependancies

Run npm install in the backend folder and then sls deploy then the invoke command again

On Feb 25, 2017, at 8:47 AM, Nikos [email protected] wrote:

tried that and got

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

DavidWells avatar Feb 25 '17 18:02 DavidWells

Thanks, just reuploaded but get this error:

You can opt-out from these warnings by setting the "SLS_IGNORE_WARNING=*" environment variable.

{ "errorMessage": "RequestId: 250a12ad-fe73-11e6-97f1-XXXXXXXXXXXX Process exited before completing request" }

quantuminformation avatar Mar 01 '17 11:03 quantuminformation

Related https://github.com/serverless/scope/issues/12

Probably need to remove the sync-request module and use something like axios for requests instead

DavidWells avatar Jun 08 '17 16:06 DavidWells