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.

Weird "Invalid project ID ... " error.

See original GitHub issue

Environment details

  • OS: Ubuntu 16.04.2 LTS, Ubuntu 16.04.4 LTS, Ubuntu 16.04.5 LTS
  • Node.js version: 8.9.4, 8.11.3, 8.15.0
  • npm version: 5.6.0, 6.7.0
  • @google-cloud/bigquery version: 2.0.3, 2.0.6
  • pm2 version: 2.10.1, 3.2.9

Description

I run node.js via pm2: pm2 restart /home/<user>/workspace/pm2.json --env development with pm2 config in json file:

{
  "apps": [
    {
      "name": "sbapi",
      "cwd": "/home/<user>/workspace/sbapi",
      "script": "./bin/www",
      "instances": 1,
      "min_uptime": "5000",
      "restart_delay": "2000",
      "exec_mode": "fork",
      "env": {
        "NODE_ENV": "development",
        "GOOGLE_APPLICATION_CREDENTIALS": "/home/<user>/workspace/sbapi/config/file_name.json"
      },
      "env_development": {
        "NODE_ENV": "development",
        "GOOGLE_APPLICATION_CREDENTIALS": "/home/<user>/workspace/sbapi/config/file_name.json"
      }
    }
  ]
}

in code with async.series I run about 38 tasks. Each send query to BigQuery:

const config = require('../../config/config');
const { BigQuery } = require('@google-cloud/bigquery');
const bigquery = new BigQuery({ projectId: config.get('googleCloud:projectId') });
const dataset = bigquery.dataset(config.get('googleCloud:bqDataset'));
const table = dataset.table(config.get('googleCloud:frontendActivitiesBQTable'));

let query = `SELECT ${queryObj.columns.join()} FROM ${config.get('googleCloud:bqDataset')}.${config.get('googleCloud:frontendActivitiesBQTable')} WHERE ${queryObj.where}`;
      if (queryObj.order) query += ` ORDER BY ${queryObj.order.join()}`;
      query += ` LIMIT 10`;
table.query(query)

as I see in console.log() my POST queries have projectId value:

{ method: 'POST',
0|sbapi  |   uri: 'https://www.googleapis.com/bigquery/v2/projects/"here I really have real project name"/jobs',
|   json: 
|    { configuration: { query: [Object] },
|      jobReference: 
|       { projectId: 'here I really have real project name',
|         jobId: '26603426-4ce9-41bd-9401-4abe9ac88555' } },
|   headers: 
|    { 'User-Agent': 'gcloud-node-bigquery/2.0.6',
|      'x-goog-api-client': 'gl-node/8.15.0 gccl/2.0.6' } }

but after about 10 good requests I get this error: body.error: { code: 400, message: ‘Invalid project ID ''. Project IDs must contain 6-63 lowercase letters, digits, or dashes. Some project IDs also include domain name separated by a colon. IDs must start with a letter and may not end with a dash.’,

   errors: 
    [ { message: 'Invalid project ID \'\'. Project IDs must contain 6-63 lowercase letters, digits, or dashes. Some project IDs also include domain name separated by a colon. IDs must start with a letter and may not end with a dash.',
        domain: 'global',
        reason: 'invalid' } ],
   status: 'INVALID_ARGUMENT' }

Maybe it’s wrong error message. P.S. It worked a month ago. Also as yurizekb wrote we can’t use bigquery normally on our project from now and project on production. It looks like some problems with API.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
yurizekbcommented, Feb 8, 2019

from https://issuetracker.google.com/issues/124026192

“After adding configuration.query.defaultDataset.projectId field to the JSON in the API explorer the error stopped showing up. This field is documented as optional (https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query), yet it seems that some of the BigQuery nodes require it. Unfortunately the JDBC driver doesn’t set this field.”

0reactions
zsdyxcommented, Sep 26, 2022

This is also the case in Python query = """ SELECT last_modified_time FROM @project_id.@dataset_id.INFORMATION_SCHEMA.PARTITIONS WHERE table_name LIKE '@table_name%' ORDER BY last_modified_time DESC limit 1 """

Read more comments on GitHub >

github_iconTop Results From Across the Web

Please help with 'Invalid project id' - Infura Community
Hi,. I am facing the same problem, I tried creating multiple accounts but for every project curl request is saying invalid project id...
Read more >
Firebase CLI always shows Error: Invalid project id
It seems Firebase CLI can get into a bad state if you accidentally use an invalid project name, then all commands will fail,...
Read more >
Invalid Project ID - QNAP NAS Community Forum
I enter the Project ID (which is part of service account ID as mentioned above) and I keep getting 'Invalid Project ID' no...
Read more >
Code 400 "Invalid project ID ... " error. Looks like API bug.
I think it looks like error in API POST request when try to add job. I saw 2 type of requests. POST request...
Read more >
Azure DevOps Services REST API -> Git repo Fork error
But then I get this (different, but equally weird) error: invalid argument value.\r\nParameter name: The project ID in the URI does not match...
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 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