Tanzu Data Flow: Task scheduling via the REST API fails with "Only deployment property keys starting with 'app.' or 'deployer.' or 'version.' allowed"
search cancel

Tanzu Data Flow: Task scheduling via the REST API fails with "Only deployment property keys starting with 'app.' or 'deployer.' or 'version.' allowed"

book

Article ID: 443588

calendar_today

Updated On:

Products

VMware Tanzu Data

Issue/Introduction

When creating a scheduled task in Tanzu Data Flow (Spring Cloud Data Flow for Cloud Foundry) by calling the /tasks/schedules REST endpoint directly with curl, the request fails with an IllegalArgumentException.

The task can be registered, created, and launched manually without issue. Only the scheduling operation via the REST API fails.

Depending on how the cron expression is placed in the request, one of the following errors is returned:

  1. When the cron key is included in the properties field:
    • {"_embedded":{"errors":[{"logref":"IllegalArgumentException","message":"Only deployment property keys starting with 'app.' or 'deployer.' or 'version.' allowed. Not spring.cloud.scheduler.cron.expression=0 * * * ?","link":{"rel":"self","href":"/"}}]}}
  2. When the cron key is moved out of the properties field:

     
    • {"_embedded":{"errors":[{"logref":"IllegalArgumentException","message":"request's scheduleProperties must have a spring.cloud.scheduler.cron.expression or spring.cloud.deployer.cloudfoundry.cron.expression that is not null nor empty","link":{"rel":"self","href":"/"}}]}}

Environment

Tanzu Data Flow (Spring Cloud Data Flow for Cloud Foundry)

Cause

The failure is caused by an incorrect request structure when calling the /tasks/schedules endpoint directly. The Data Flow dashboard UI succeeds because it constructs the request differently from the manual curl command.

Resolution

The correct request structure was determined by capturing the request the UI sends using the browser's Developer Tools (Network tab) and inspecting the request payload.

  1. Open the Data Flow dashboard in a Chrome browser.
  2. Open Developer Tools (F12) and select the Network tab.
  3. Create a schedule through the UI.
  4. Locate the POST request to /tasks/schedules.
  5. Open the Payload tab to view the exact field names and values submitted.
  6. Replicate that structure in the curl command.

Construct the curl request to match the structure the UI submits, confirmed by inspecting the UI's network payload.

  • Use the deployer.*.cron.expression key for the cron expression, placed in the properties field. This key is accepted by the deployment-property validator because it begins with deployer..

Example:

curl -H "Authorization: $(cf oauth-token)" \
  "https://dataflow-<service-guid>.<apps-domain>/tasks/schedules" \
  -i -X POST \
  -d "scheduleName=<schedule-name>" \
  -d "taskDefinitionName=<task-definition-name>" \
  -d "platform=default" \
  -d "properties=deployer.*.cron.expression=0 16 ? * *" \
-d "arguments=--spring.profiles.active=<profile1>,<profile2>"