Serverless error : Value not found at "self"

49 views Asked by At

I have this problem with serverless deploy. Error message is Cannot resolve variable at "resources.Resources.ClientsTable.Properties.TableName": Value not found at "self" source" when I try to run the yarn deploy command on my serverless project.

I dont know where is problem. I attached screen with error from CLI.

Can you help me please ?

enter image description here

I check this problem Serverless .yml error when running serverless deploy but without result

# Welcome to Serverless!

service: websocket-server-api-gw
frameworkVersion: "3"

provider:
  name: aws
  runtime: nodejs20.x
  lambdaHashingVersion: 20201221
  stage: ${opt:stage, 'dev'}
  
environment:
    CLIENTS_TABLE_NAME: ${self:provider.stage}WSClients
    WSSAPIGATEWAYENDPOINT:
      Fn::Join:
        - ""
        - - "https://"
          - Ref: WebsocketsApi
          - ".execute-api."
          - Ref: AWS::Region
          - ".amazonaws.com/${sls:stage}"
region: us-east-1

iam:
    role:
      statements:
        - Effect: Allow
          Action:
            - "dynamodb:PutItem"
            - "dynamodb:DeleteItem"
            - "dynamodb:Scan"
          Resource:
            - { "Fn::GetAtt": ["ClientsTable", "Arn"] }

functions:
  websocketHandler:
    handler: src/handlers.handle
    events:
      - websocket:
          route: $connect
      - websocket:
          route: $disconnect
      - websocket:
          route: $msg     


plugins:
  - serverless-plugin-typescript
resources:
  Resources:
    ClientsTable:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: ${self:provider.environment.CLIENTS_TABLE_NAME}
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
        AttributeDefinitions:
          - AttributeName: connectionId
            AttributeType: S
        KeySchema:
          - AttributeName: connectionId
            KeyType: HASH
        
0

There are 0 answers