IF conditionals throw warning errors under functions property (Configuration warning)

I am attempting to solve a few of the deprecation warnings that have been coming up when running npx serverless package. There is a function in the serverless.yml file that has a conditional property on it to be able to decide which bucket is used. eg.

      isFirstBucketEmtpy: !Equals [!Ref SecondBucket, ""]

    handler: handler/path
      - s3:
          bucket: !If [ isFirstBucketEmtpy, !Ref FirstBucket, !Ref SecondBucket ]
          event: s3:ObjectCreated:*
            - prefix: prefix/here
          existing: true

This syntax has been working ok and resolving fine in the cloudformation code eg.

"BucketName": {
          "Fn::If": [
              "Ref": "FirstBucket"
              "Ref": "SecondBucket"

The warning that is shown is:

Configuration warning at 'functions.functionName.events[0].s3.bucket': unsupported object format

Would be great to know what the actual syntax is for this issue, as aware on the next release this will instead throw an error ( Service configuration validation)

@leah-clark please open issue at https://github.com/serverless/serverless/issues

I believe it’s simply because we do not support Fn::If intristic function at this property. This can be easily fixed by updating the schema, and if that’s the case you may go directly with PR

I also think that it’s can be fixed by updating the schema.

Appvalley TutuApp Tweakbox