Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to set regional enpoint in google dataflow client #1034

Closed
bdahon opened this issue Mar 2, 2018 · 4 comments
Closed

Impossible to set regional enpoint in google dataflow client #1034

bdahon opened this issue Mar 2, 2018 · 4 comments
Assignees

Comments

@bdahon
Copy link

bdahon commented Mar 2, 2018

According to documentation, one can set the execution region of a template through the location parameter. I'm trying to send the following payload:

{
  projectId: 123,
  resource: {
    location: "europe-west1",
    jobName: `xxx`,
    gcsPath: 'gs://xxx'
  }
}

I get the following response:

The workflow could not be created, since it was sent to an invalid regional endpoint (europe-west1). Please resubmit to a valid Cloud Dataflow regional endpoint.

Even if I switch back to us-east1, I get the same error:

The workflow could not be created, since it was sent to an invalid regional endpoint (us-east1). Please resubmit to a valid Cloud Dataflow regional endpoint.

Doing the same in the API explorer seems to be working fine:

image

My template was created using Apache Beam Java SDK 2.3.0

I don't know if this is a bug or a misunderstanding on my side on how to run a template in a specific region.

Thanks

@gxercavins
Copy link

I get the same error, too, with a template that allows regional endpoints using the console/API instead. Code snippet I used with just some dummy parameters:

var {google} = require('googleapis');
const project = "PROJECT_ID"

let result;
google.auth.getApplicationDefault(function(err, authClient, projectId) {
        if (err) {
            throw err;
        }
        if (authClient.createScopedRequired && authClient.createScopedRequired()) {
            authClient = authClient.createScoped([
                'https://www.googleapis.com/auth/compute'
            ]);
        }
        var dataflow = google.dataflow({
            version: "v1b3",
            auth: authClient
        });
        //just testing if it runs or not
        var launchParams = {
            "input": "gs://your-input-bucket/*.txt"
        };
        var env = {
           "tempLocation": "gs://your-staging-bucket/temp"
        }
        var opts = {
            projectId: project,
            location: "europe-west1",
            gcsPath: "gs://dataflow-templates/latest/GCS_Text_to_BigQuery",
            resource: {
                parameters: launchParams,
                environment: env
            }
        };
        dataflow.projects.templates.launch(opts, (err, result) => {
            if (err) {
                throw err;
            }
            res.send(result.data);
        });
});

@aleguerrini
Copy link

I confirm. I have the same problem too.

@mahmoudhanafy
Copy link

I have the same problem but with the java client.
any solution for it ?

@mahmoudhanafy
Copy link

I found the cause of this problem. You can see at the API explorer that there are 2 endpoints for launching a template.
image

so the problem we all have here is that we are trying to set the location for the first API dataflow.projects.templates.launch.

So if you change it to dataflow.projects.locations.templates.launch it will work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants