scope
scope copied to clipboard
[question] invoke setup function gives Bad credentials error
I tried to run the setup function, do I need to create an API token?

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
See https://www.youtube.com/watch?v=dbfTNYgWIuI
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 .
Cool, do I just tick the repo ones?

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 =)
I updated my local key and re-ran but get the same error with the above creds:

I added a whole bunch of new permissions and got the same error. it will be easier when we can debug local lambda functions
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

It looks like your auth token from github is incorrect
Also run sls logs -f setup -t to tail your logs to see any error coming back from the lambda function
sil = serverless invoke local -f
Postman works fine:

Running sls logs -f setup -t gives:

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.
tried that and got

:)
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.
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" }
Related https://github.com/serverless/scope/issues/12
Probably need to remove the sync-request module and use something like axios for requests instead