import (
dataflow "cloud.google.com/go/dataflow/apiv1beta3"
"cloud.google.com/go/functions/metadata"
"context"
"fmt"
dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3"
"log"
"os"
)
...
func KickDataflow(ctx context.Context, start, end string) error {
client, err := dataflow.NewTemplatesClient(ctx)
if err != nil {
return err
}
defer client.Close()
req := &dataflowpb.CreateJobFromTemplateRequest{
ProjectId: "xxx",
JobName: fmt.Sprintf("transform-orders_%s", start),
Template: &dataflowpb.CreateJobFromTemplateRequest_GcsPath{
GcsPath: gcsPath,
},
Parameters: map[string]string{
"input": fmt.Sprintf("gs://xxx/order_updates/dt=%s/orders_%s_%s.jsonl", start, start, end),
},
Environment: &dataflowpb.RuntimeEnvironment{
NumWorkers: int32(1),
MaxWorkers: int32(3),
WorkerZone: "asia-northeast1-b",
TempLocation: tempLocation,
ServiceAccountEmail: os.Getenv("SERVICE_ACCOUNT"),
},
Location: "asia-northeast1",
}
_, err = client.CreateJobFromTemplate(ctx, req)
if err != nil {
return err
}
}
It returns the error.
error in kicking dataflow job: rpc error: code = FailedPrecondition desc = (9abc46254fa5372d): The workflow could not be created, since it was sent to an invalid regional endpoint (asia-northeast1). Please resubmit to a valid Cloud Dataflow regional endpoint. The list of Cloud Dataflow regional endpoints is at https://cloud.google.com/dataflow/docs/concepts/regional-endpoints.
There seems to be the same issue in Node.js client. Google Dataflow - Invalid Regional Endpoint - Impossible set region on template from nodejs client
How to resolve this issue using Go client?