Skip to content

Google Cloud Retail: updateMask values must be snake_case despite being camelCase on the Product Interface #3187

Open

Description

Activity

  1. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    triage meI really want to be triaged.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Apr 27, 2023
  2. tmk1991 commented on Aug 10, 2025

    @tmk1991

    I think this is still an issue. However it executes okay with the API but the SDK throws an error.

    async function updateMinInstances(
      functionName: string,
      functionRegion: string,
      minInstances: number
    ): Promise<void> {
      const name = `projects/${PROJECT_ID}/locations/${functionRegion}/functions/${functionName}`;
      try {
        const request: protos.google.cloud.functions.v1.IUpdateFunctionRequest = {
          function: {
            name,
            minInstances,
            maxInstances: null // Setting maxInstances to null (or omitting it) effectively removes the limit.
          },
          // Corrected the updateMask to be an object with a 'paths' array.
          updateMask: {
            paths: ['min_instances', 'max_instances']
          }
        };
    
        // Make the API call to update the function
        const [operation] = await client.updateFunction(request);
        const [response] = await operation.promise();
        console.log(
          `Successfully updated minInstances to ${minInstances} for function: ${functionName}`,
          response
        );
      } catch (error) {
        // We cast the error to be able to access its message property.
        console.error(`Error updating function ${functionName}: ${(error as Error).message}`, error);
      }
    }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.samplesIssues that are directly related to samples.triage meI really want to be triaged.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