extensions icon indicating copy to clipboard operation
extensions copied to clipboard

🐛 [fs-bq-schema-views] Getting "ProjectId must be non-empty" HTTP error

Open romulets opened this issue 2 months ago • 8 comments

[READ] Step 1: Are you in the right place?

Yes.

[REQUIRED] Step 2: Describe your configuration

  • Extension name: fs-bq-schema-views
  • Extension version: 0.4.12
  • Configuration values (redact info where appropriate):
npx @firebaseextensions/fs-bq-schema-views \
  --non-interactive \
  --project=${project} \
  --big-query-project=${project} \
  --dataset=clinicas_firebase_export \
  --table-name-prefix=clinicas \
  --schema-files=./clinicas.json

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

What happened? How can we make the problem occur? This could be a description, log/console output, etc.

I run the command

npx @firebaseextensions/fs-bq-schema-views \
  --non-interactive \
  --project=${project} \
  --big-query-project=${project} \
  --dataset=clinicas_firebase_export \
  --table-name-prefix=clinicas \
  --schema-files=./clinicas.json

It passes local validation, however it gives me back an API error. I suspect an API got updated, but not the script.

I know the project is being read from the stdin because if I run

npx @firebaseextensions/fs-bq-schema-views \
  --non-interactive \
  --project-a=${project} \
  --big-query-project=${project} \
  --dataset=clinicas_firebase_export \
  --table-name-prefix=clinicas \
  --schema-files=./clinicas.json

The error message is error: unknown option '--project-a=${project}'. So all the options are passed properly and the problem is once hitting an API.

Expected result

It generates the schema properly.

Actual result
{"code":400,"errors":[{"message":"ProjectId must be non-empty","domain":"global","reason":"badRequest"}],"response":{"headers":{"alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000","content-type":"application/json; charset=UTF-8","date":"Tue, 14 Oct 2025 13:44:45 GMT","transfer-encoding":"chunked"}},"message":"ProjectId must be non-empty"}
ProjectId must be non-empty
```

romulets avatar Oct 14 '25 13:10 romulets

Hi @romulets.

Does the script work if you pass in a typical value, for example:

npx @firebaseextensions/fs-bq-schema-views \
  --non-interactive \
  --project=my-project \
  --big-query-project=my-project \
  --dataset=clinicas_firebase_export \
  --table-name-prefix=clinicas \
  --schema-files=./clinicas.json

CorieW avatar Oct 14 '25 15:10 CorieW

Yes, I just didn't paste the project name here.

The command I run is

npx @firebaseextensions/fs-bq-schema-views \
  --non-interactive \
  --project=project \
  --big-query-project=project \
  --dataset=clinicas_firebase_export \
  --table-name-prefix=clinicas \
  --schema-files=./clinicas.json
Image

romulets avatar Oct 20 '25 08:10 romulets

I haven't been able to reproduce this.

What happens if you run like this:

npx @firebaseextensions/fs-bq-schema-views --non-interactive --project=your-project --big-query-project=your-project --dataset=clinicas_firebase_export --table-name-prefix=clinicas --schema-files=./clinicas.json

CorieW avatar Oct 21 '25 15:10 CorieW

Found the issue, if the project name is wrong we get this message (that is confusing). Once I fixed the project name it worked!

romulets avatar Oct 22 '25 18:10 romulets

Ah, I see. That is definitely a poor error message. This is something that needs fixed.

Note: I'm not sure where this error comes from, as I can't find it in the codebase. Maybe this is something that could be more difficult than it should be to fix, requiring quite a bit of work.

CorieW avatar Oct 22 '25 19:10 CorieW

It seems to come from a web service. I'm not very into the lib itself, but could just be a poor message from even bigquery itself.

If I can contribute somehow, happy to do so. But I think this is out of the realm of open source

romulets avatar Oct 23 '25 07:10 romulets

Yeah, this issue seems to be caused by @google-cloud/bigquery. I thought that by upgrading to the latest version that this error might be fixed. Unfortunately, the error only becomes less clear:

{"code":400,"errors":[{"message":"Cannot parse  as CloudRegion.","domain":"global","reason":"badRequest"}],"response":{"headers":{"alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000","content-type":"application/json; charset=UTF-8","date":"Thu, 23 Oct 2025 07:48:23 GMT","transfer-encoding":"chunked"}},"message":"Cannot parse  as CloudRegion."}

https://stackoverflow.com/questions/71400730/hitting-bigquery-from-golang-app-fails-with-400-status-code

Perhaps for now, catching the "ProjectId must be non-empty" error and handling it by returning a clearer message (e.g. "The ProjectId 'blahblahblah' is not valid.") could be done. A bit of a cheap fix imo, but not sure what else can be done.

CorieW avatar Oct 23 '25 08:10 CorieW

Sounds like a good patch for now, it will be less confusing for sure!

romulets avatar Oct 23 '25 08:10 romulets