Getting "Value not found at opt source" error after upgrading from 2.0.0 to 2.72.3

I inherited a project from a previous dev who left the company, that uses serverless. The project is structured such that we have a separate serverless yaml file for each “service” we deploy and a single python script that we use to deploy. We pass CLI params like so:
npm run serverless -- deploy --elastic <value> ...

In the YAML file, I use the elastic variable like so:

service: devices
variablesResolutionMode: 20210326
  - serverless-plugin-typescript
  - serverless-offline
  - serverless-domain-manager
  - serverless-prune-plugin
  name: aws
  versionFunctions: false
  runtime: nodejs12.x
    STAGE: ${self:provider.stage}
    PROFILE: ${opt:profile, 'dev'}
    ES_HOST_URL: ${opt:elastic}

When I run the script, I get the following error:

 Serverless Error ----------------------------------------

  Cannot resolve serverless.yml: Variables resolution errored with:
    - Cannot resolve variable at "provider.environment.ES_HOST_URL": Value not found at "opt" source

If I replace ${opt:elastic} with its value in the YAML file, I don’t get the error, but I don’t want it hardcoded.
My serverless and its plugins versions are:

    "serverless": "^2.72.3",
    "serverless-api-compression": "^1.0.1",
    "serverless-domain-manager": "^6.0.3",
    "serverless-offline": "^8.7.0",
    "serverless-plugin-split-stacks": "^1.11.3",
    "serverless-plugin-tracing": "^2.0.0",
    "serverless-plugin-typescript": "^2.1.2",
    "serverless-prune-plugin": "^2.0.1",
    "serverless-pseudo-parameters": "^2.6.1",
    "serverless-python-requirements": "^5.4.0",
    "serverless-step-functions": "^3.7.0",

I’d appreciate any help in resolving this issue.

Thank you