7

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?

4
  • 1
    I tried to serverless print your example with the same framework version and the variable resolves correctly. What is your output for the REGION withserverless print? Commented Feb 8, 2022 at 11:57
  • serverless print Environment: win32, node 16.1.0, framework 3.0.0, plugin 6.0.0, SDK 4.3.0 Docs: docs.serverless.com Support: forum.serverless.com Bugs: github.com/serverless/serverless/issues Error: The Serverless version (3.0.0) does not satisfy the "frameworkVersion" (^2.72.2) in serverless.yml Commented Feb 8, 2022 at 11:59
  • I continue to get same error message from serverless print even after updating serverless yml to have: frameworkVersion: "2 || 3" Commented Feb 8, 2022 at 12:02
  • Might be obvious, but have you double/triple checked that you are in the correct folder (where the right yaml file is) when you execute the command.. (and that the file is saved correctly)?. Given that serverless doesn't react to the frameworkVersion change and that you still can't print. Commented Feb 8, 2022 at 12:35

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.