Dear Community,
while I tried to set up serverless I encountered the following screen:
https://b3pe6tfdal.execute-api.eu-central-1.amazonaws.com/dev/api/get-auth-url
I am fairly new to serverless and AWS therefore I have been trying to reach anyone who could rather better understand explain what might not be working.
I created a OAuth consumer and it seems to be find.
I set up serverless the following way:
npm install -g serverless
serverless create --template aws-nodejs --path auth-server
cd auth-server
npm init
Afterwards I created a key, downloaded and executed:
serverless config credentials --provider aws --key ACCESS_KEY_ID --secret SECRET_ACCESS_KEY
(I did replace the examples-Access_Key_id & Access_key).
Now if I run this URL:
https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar.readonly&response_type=code&client_id=MY_CLIENT_ID&redirect_uri=https%3A%2F%2Fherra17.github.io%2Fmeet%2F
I get this-> https://herra17.github.io/meet/?code=4/0AVHEtk7XivdkSnIIzX9SMhFXBtPCvbXYExk8PpDA-sE1mtG4HxiYz-Wp6j6Fn1ls2FKCog&scope=https://www.googleapis.com/auth/calendar.readonly
(I am not sure that I can share a screen).
Know locally if I do serverless invoke local --function getAuthURL I get:
{
"statusCode": 200,
"headers": {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials": true
},
"body": {
"authUrl": "https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar.readonly&response_type=code&client_id=MY_CLIENT_ID&redirect_uri=https%3A%2F%2Fherra17.github.io%2Fmeet%2F"
}
},
as well if I test it in Lambda console: I get a status of 200,
serverless info returns
service: auth-server
stage: dev
region: eu-central-1
stack: auth-server-dev
console: https://console.serverless.com/herra17/metrics/awsLambda?globalEnvironments=dev&globalNamespace=auth-server&globalRegions=eu-central-1&globalScope=awsLambda&globalTimeFrame=15m
endpoints:
GET - https://b3pe6tfdal.execute-api.eu-central-1.amazonaws.com/dev/api/get-auth-url
GET - https://b3pe6tfdal.execute-api.eu-central-1.amazonaws.com/dev/api/token/{code}
functions:
getAuthURL: auth-server-dev-getAuthURL
getAccessToken: auth-server-dev-getAccessToken,
Anyhow the endpoint for the get-auth-url throws me the internal server error.
Specifically a screen with :
//numbers which I am not sure they represent important data
// https://b3pe6tfdal.execute-api.eu-central-1.amazonaws.com/dev/api/get-auth-url
{
"message": "Internal server error"
}
I have tried to follow along the following Resource but I do not seem to have the Monitor option under the selected HTTP API, hence I can not proceed.
https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-troubleshooting-lambda.html
Any thoughts
I am using Node.js, Express as Lambda, React.