question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A project ID is required

See original GitHub issue

Hi,

I try to use the spark connector on my Apache Spark cluster with Scala but can’t because of the following error: java.lang.IllegalArgumentException: A project ID is required for this service but could not be determined from the builder or the environment. Please set a project ID using the builder.

Here my code

import org.apache.spark.sql.SparkSession
import com.google.cloud.spark.bigquery._

val spark = SparkSession.builder
  .getOrCreate()

spark.conf.set("credentialsFile", "my.json")

spark.read.bigquery("project_id.datasets.tablel")

I installed spark_bigquery_latest.jar on the cluster and even try the global environment variable option but nothing works.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
davidrabinowitzcommented, Apr 27, 2020

Hi @morganvill

Is the credential file a personal one or a service account? Personal credentials files do not contain the project id. You can either set the parent project id in the code in the read option: spark.read.format("bigquery").option("parentProject", "<your-gcp-project-id>").option("table", "project_id.datasets.tablel").load(); Alternatively you can set the GOOGLE_CLOUD_PROJECT environment variable, pointing to your project id.

2reactions
Paulito123commented, Jun 21, 2021

Adding the option .option(“parentProject”, “<your-gcp-project-id>”) did the trick for me. Thanks for the help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Project ID is required - Ethereum Stack Exchange
You need to: Sign up with Infura.io · Login into Infura.io; Click CREATE NEW PROJECT button and enter project name. Then in project...
Read more >
How to fix error: A project ID is required for this service but ...
In my case the next code is working: BigQuery bigquery = BigQueryOptions.newBuilder().setProjectId("XXXXX") .
Read more >
Creating and managing projects - Google Cloud
Project ID: A globally unique identifier for your project. A project ID is a unique string used to differentiate your project from all...
Read more >
Locate the project ID - API Console Help - Google Help
There are two ways to identify your project: the project name and project ID. ... The project ID is a unique identifier for...
Read more >
error create token HTTPError: project id required - Bugs
Make sure you are passing authentication when making requests. Project id and project secret are required when using Infura IPFS. rik ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found