Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)}
...
like image 288
vladimirp Avatar asked Dec 27 '20 12:12

vladimirp


3 Answers

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.

like image 96
vladimirp Avatar answered Oct 19 '22 00:10

vladimirp


I had to remove org: <org> in order for it to ask me again next time sls is run.

like image 4
haxpanel Avatar answered Oct 19 '22 01:10

haxpanel


Try using serverless logout or deleting the ~\.serverlessrc file then run serverless login again and try your command

like image 1
Gareth McCumskey Avatar answered Oct 19 '22 00:10

Gareth McCumskey