Deployment to stage results in new API instead of to stage

When I run sls deploy --stage prod I end up with a new API named prod-MYAPI instead of having it deploy to the prod stage of the MYAPI. Why is this?

In my serverless.yml, I have this:

service: MYAPI

  name: aws
  runtime: nodejs8.10
  stage: dev
  memorySize: 512
    env: ${self:provider.stage}
  region: us-east-1
  profile: devprofile  
    - Effect: Allow
        - dynamodb:Query
        - dynamodb:Scan
        - dynamodb:GetItem
        - dynamodb:PutItem
        - dynamodb:UpdateItem
        - dynamodb:DeleteItem
        - dynamodb:BatchWriteItem
        - dynamodb:BatchGetItem
        - "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/ps_${self:provider.stage}_users"
        - "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/ps_${self:provider.stage}_sessions"
    - Effect: Allow
      Action: ses:SendEmail
      Resource: "*"
    STAGE: ${self:provider.stage}

The first time I deployed, I ran sls deploy and got an API named dev-MYAPI, which I renamed to just MYAPI in the AWS console.

In AWS API-Gateway, under APIS, I saw just one API, named MYAPI. In the list of stages for that API, I created 4 stages, dev, test, staging and prod. I then ran this:

sls deploy --stage prod

After I ran that, I got a new API named prod-MYAPI in the APIS section of API-Gateway console. I did not see anything new (no new deployment set) for the prod stage of MYAPI.

Why is this happening? I’ve spent a couple of hours on this, and can’t figure out what I have set wrong.

the serverless framework, composes the name, which comes from your stage-service

So, the name will always be [stage]-[service] for the api? Is there a way to deploy the code to the specified stage for the named service? I basically end up with 4 APIs, each with one stage, rather than one api with 4 stages. Is it not possible to deploy the API to the same service but to a different stage in the same service? It seems like a bug to specify a stage for a deployment, but end up with a new API with prefixed by the name of the deployment and with only one stage. That is, “staging” in this case seems to just be creating a new API. It seems like there should be a way to overrride this and deploy to a stage in the API name I created.

Right now, I end up with
stage: prod
stage: staging
stage: test
stage: dev

What I expected, and wanted was:

stage: prod
stage: staging
stage: test
stage: dev

Hi there,
I am having the same problem. Have you found any good solution for this?
Would appreciate any ideas.

I was also a bit surprised by this. I assumed that each stage will be in one api gateway, instead each stage gets its own api gateway. Is there a way to change that?