Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.
This repository was archived by the owner on Mar 19, 2026. It is now read-only.

Unable to set httpTarget update mask in gRPC scheduler client #604

Closed

Description

@bcoe

There is an odd issue occurring, in which setting the httpTarget update mask on the scheduler client results in the following exception:

Error: 3 INVALID_ARGUMENT: Invalid mask for Job: httpTarget at Object.callErrorFromStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call.js:31:26) at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client.js:179:52) at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:336:141) at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181) at /workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:145:78 at processTicksAndRejections (internal/process/task_queues.js:79:11)

Similar code in the Python gRPC client succeeds:

from google.cloud import scheduler_v1beta1
from google.protobuf.field_mask_pb2 import FieldMask
 
job_id="http_job"
location="us-central1"
project="ekaramad-playground"
 
job_name=f"projects/{project}/locations/{location}/jobs/{job_id}"
 
client = scheduler_v1beta1.CloudSchedulerClient()
 
job = client.get_job(name=job_name)
print(job)
# client.update_job(job={'name': job_name, 'http_target': {'uri': 'https://www4.google.ca'}})
mask = FieldMask()
mask.FromJsonString('httpTarget')
client.update_job(job=job, update_mask=mask)

This makes me think the issue is potentially a problem with the generator.

CC: @averikitsch

Activity

  1. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    on Jul 29, 2021
  2. added
    🚨This issue needs some love.
    and removed
    🚨This issue needs some love.
    on Aug 4, 2021
  3. summer-ji-eng commented on Aug 5, 2021

    @summer-ji-eng
    Contributor

    I am able to reproduce the error on my local. The error is directly from the service with returning a metadata, has the following 3 fields.
    image
    I don't see any suspect error in client library or gax-nodejs. I wonder if it is possible the API service team has issue?

    try {
     const getJobRequest = {
      name: jobName
    }
      const [job] = await client.getJob(getJobRequest);
      console.log(`job: ${JSON.stringify(job)}`);
      const updateRequest = {
        job: {
          name: jobName,
          description: 'summer edit',
          httpTarget: {
            uri: url,
            httpMethod: 'POST',
            body: Buffer.from('Hello World Again'),
          },
        },
        updateMask: {
          paths: ['httpTarget'],
        },
      }
      const [response] = await client.updateJob(updateRequest);
      console.log(`Updated job: ${JSON.stringify(response)}`);
    } catch (err) {
      console.log(err);
    }
    

    The error log:

    Error: 3 INVALID_ARGUMENT: Invalid mask for Job: httpTarget
        at Object.callErrorFromStatus (/Users/summerji/Work/nodejs/tryScheduler/node_modules/@grpc/grpc-js/build/src/call.js:31:26)
        at Object.onReceiveStatus (/Users/summerji/Work/nodejs/tryScheduler/node_modules/@grpc/grpc-js/build/src/client.js:179:52)
        at Object.onReceiveStatus (/Users/summerji/Work/nodejs/tryScheduler/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:336:141)
        at Object.onReceiveStatus (/Users/summerji/Work/nodejs/tryScheduler/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)
        at /Users/summerji/Work/nodejs/tryScheduler/node_modules/@grpc/grpc-js/build/src/call-stream.js:145:78
        at processTicksAndRejections (internal/process/task_queues.js:77:11) {
      code: 3,
      details: 'Invalid mask for Job: httpTarget',
      metadata: Metadata {
        internalRepr: Map(1) { 'grpc-server-stats-bin' => [Array] },
        options: {}
      }
    }
    
  4. summer-ji-eng commented on Aug 5, 2021

    @summer-ji-eng
    Contributor

    The most of fields of job is able to update, except for httpTarget, pubsubTarget, schedule, timezone and some of output only field is ignored.
    According to AIP161"the service may choose to error with INVALID_ARGUMENT if the field is modified in input."

    Will close the ticket for now. Feel free to reach out if you have further question. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions