简体   繁体   中英

Serverless Framework - Value not found at "self" source

I have the following serverless.yml file:

org: bizrob
app: flexipod-2-queue
service: flexipod-2-queue

frameworkVersion: "^2.72.2"

custom:
  region: eu-west-1

provider:
  name: aws
  runtime: nodejs14.x

plugins:
  - serverless-prune-plugin
  - serverless-offline
  - serverless-webpack
  - serverless-plugin-resource-tagging
  - serverless-step-functions

functions:
  cronHandler:
    handler: flexipod-2-queue/flexipodJob.dataFeedsJob
    events:
      # Invoke Lambda function every 2nd minute from Mon-Fri
      - schedule: cron(0/8 * ? * MON *)
    environment:
      REGION: ${self:custom.region}
      API_VERSION_S3: "2006-03-01"
      API_VERSION_SQS: "2012-11-05"
      SQS_QUEUE_URL: !Ref "MyQueue"

resources:
  Resources:
    MyQueue:
      Type: "AWS::SQS::Queue"
      Properties:
        QueueName: "flexipod"

When I run serverless deploy, I get the following error:

Cannot resolve variable at "functions.cronHandler.environment.REGION": Value not found at "self" source

Anyone see what I've done wrong please?

Thanks to @eli6 for the tip about serverless print. I don't know the root cause of the problem but after restarting vscode serverless print and serverless deploy then worked

Little too late on subject, but similar issue here, I think. If someone was strugling on this (like I was), maybe is a good ideia to check it out: https://github.com/serverless/examples/issues/689

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM