Home > database >  Serverless deploy does not create API gateway
Serverless deploy does not create API gateway

Time:10-30

Here is my serverless.yml file:

service: investor-bot


provider:
  name: aws
  runtime: python3.9
  stage: dev


functions:
  post:
    handler: handler.hello
    events:
      - http:
          path: ita-investor-bot
          method: get

Here is code (even with this code it does not work):

def hello(event, context):
    return {"statusCode": 200}

I exported my AWS credentials and ran serverless deploy:

Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service investor-bot.zip file to S3 (12.77 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
.......................................
Serverless: Stack update finished...
Service Information
service: investor-bot
stage: dev
region: us-east-1
stack: investor-bot-dev
resources: 11
api keys:
  None
endpoints:
  GET - https://933zcto8tc.execute-api.us-east-1.amazonaws.com/dev/ita-investor-bot
functions:
  post: investor-bot-dev-post
layers:
  None
Serverless: Removing old service artifacts from S3...
Serverless: Deprecation warning: Resolution of lambda version hashes was improved with better algorithm, which will be used in next major release.
            Switch to it now by setting "provider.lambdaHashingVersion" to "20201221"
            More Info: https://www.serverless.com/framework/docs/deprecations/#LAMBDA_HASHING_VERSION_V2

Toggle on monitoring with the Serverless Dashboard: run "serverless"

I see nothing at the AWS account in API Gateway. I can not access endpoint: enter image description here

CodePudding user response:

There's definitely a deployed API Gateway. You've deployed your stack in us-east-1, my best guess is that you're using the AWS console in another region.

When logged in to the AWS console, use the region switcher on the top-right to switch to us-east-1, from there you should see your API Gateway, lambda function, and cloudwatch logs.

  • Related