Search code examples
amazon-web-servicesdeploymentserverless-framework

Serverless framework deployment error: You're not authorized to access this resource


When I deploy my serverless framework project using AWS as provider I get:

You're not authorized to access this resource. - Please contact support and provide this identifier to reference this issue BLAHBLAH

I am logged into Serverless framework with serverless login

My serverless.yaml:

org: vladimirorg
app: vladimirapp
service: backend-rest

provider:
  name: aws
  runtime: nodejs12.x
  apiGateway: {
    shouldStartNameWithService: true
  }

  environment:
    DYNAMODB_TABLE: ${self:service}-${opt:stage, self:provider.stage}
    DYNAMODB_LOCAL_PORT: 9000
  iamRoleStatements:
    - Effect: Allow
      Action:
        - dynamodb:Query
        - dynamodb:Scan
        - dynamodb:GetItem
        - dynamodb:PutItem
        - dynamodb:UpdateItem
        - dynamodb:DeleteItem
      Resource: "arn:aws:dynamodb:#{AWS::Region}:#{AWS::AccountId}:table/${self:provider.environment.DYNAMODB_TABLE}"

functions:
  create:
    handler: src/handlers/create.create
    events:
      - http:
          path: todos
          method: post
          cors: true
          request:
            schema:
              application/json: ${file(src/schemas/create.json)}
...

Solution

  • I have found the root cause - if you wish to deploy serverless framework application you must use the exact same organization (org) and application name (app) as one you registered with serverless framework.

    To find out your current app/org name, change them or create new app/org login to Serverless Framework’s dashboard account on https://app.serverless.com/ using same credentials you use for deploying and make sure you are using the exact org and app in your serverless.yaml file:

    org: orgname  <---
    app: appname  <--- 
    service: backend-rest
    ...
    
    

    So you can't just use any arbitrary org/app name, you must use exact org/app registered with Serverless framework.