部署微小版本后调用BigQuery、Pub/Sub及Secret Manager持续出现404错误的排查求助
部署微小版本后调用BigQuery、Pub/Sub及Secret Manager持续出现404错误的排查求助
各位大佬,遇到一个棘手的问题想请教下!昨天下午6:30开始,我们所有调用BigQuery、Pub/Sub和Secret Manager的请求全部返回404错误,不管是哪种API调用方式都不行。
刚好那段时间我部署了一个新版本,但改动真的非常小——只是改了一条日志消息而已。而且5小时前的一次部署完全没问题,运行一切正常。
我们的环境是Node.js 20,API用的是Google Cloud Functions(第一代和第二代都有)。不管是通过HTTPS调用API、Pub/Sub触发函数,还是调用可调用函数,都会失败,而且404都是出在调用这三个Google服务的时候(可能还有其他服务,但目前发现的是这三个)。
部署过程没有任何错误提示,我也把@google-cloud/bigquery这类依赖包更新到最新版本了,但问题还是没解决。
下面是一个检查BigQuery表是否存在的简单代码片段,404就出在标注的那一行:
import { BigQuery } from '@google-cloud/bigquery'; let bigquery: BigQuery; export async function checkTableExists(dataset: string, table: string): Promise<boolean> { bigquery = new BigQuery(); const tableExists = await bigquery.dataset(dataset).table(table).exists(); // <-- 这里返回404 return tableExists[0]; }
报错信息看起来像是认证问题,但这个API已经稳定运行好几年了,昨天两次部署之间,我们的配置、服务账号这些完全没改动过。完整的错误栈如下:
Unhandled error GaxiosError: Unsuccessful response status code. Request failed with status code 404 at Gaxios._request (/workspace/node_modules/gcp-metadata/node_modules/gaxios/build/src/gaxios.js:141:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async metadataAccessor (/workspace/node_modules/gcp-metadata/build/src/index.js:110:21) at async GoogleAuth._GoogleAuth_getUniverseFromMetadataServer (/workspace/node_modules/google-auth-library/build/src/auth/googleauth.js:777:26) at async GoogleAuth.getUniverseDomain (/workspace/node_modules/google-auth-library/build/src/auth/googleauth.js:186:168) at async GoogleAuth.getApplicationDefaultAsync (/workspace/node_modules/google-auth-library/build/src/auth/googleauth.js:252:42) at async GoogleAuth.getClient (/workspace/node_modules/google-auth-library/build/src/auth/googleauth.js:674:17) at async GoogleAuth.authorizeRequest (/workspace/node_modules/google-auth-library/build/src/auth/googleauth.js:715:24) at async Promise.all (index 1) at async prepareRequest (/workspace/node_modules/@google-cloud/common/build/src/util.js:442:61) { config: { url: 'http://169.254.169.254/computeMetadata/v1/universe/universe_domain', headers: { 'Metadata-Flavor': 'Google' }, retryConfig: { noResponseRetries: 3, currentRetryAttempt: 0, retry: 3, httpMethodsToRetry: [Array], statusCodesToRetry: [Array] }, params: {}, responseType: 'text', timeout: 0, paramsSerializer: [Function: paramsSerializer], validateStatus: [Function: validateStatus], method: 'GET', errorRedactor: [Function: defaultErrorRedactor] }, response: { config: { url: 'http://169.254.169.254/computeMetadata/v1/universe/universe_domain', headers: [Object], retryConfig: [Object], params: {}, responseType: 'text', timeout: 0, paramsSerializer: [Function: paramsSerializer], validateStatus: [Function: validateStatus], method: 'GET', errorRedactor: [Function: defaultErrorRedactor] }, data: '404 page not found\n', headers: { 'content-length': '19', 'content-type': 'text/plain; charset=utf-8', date: 'Thu, 30 Nov 2023 13:44:09 GMT', 'x-content-type-options': 'nosniff' }, status: 404, statusText: 'Not Found', request: { responseURL: 'http://169.254.169.254/computeMetadata/v1/universe/universe_domain' } }
有没有大佬知道突然出现这种全面故障可能是什么原因?已经问过Google Support了,他们说那边没有服务中断情况。实在搞不懂为啥改了条日志就炸了🥲
备注:内容来源于stack exchange,提问作者Steven Roth
相关产品推荐
相关产品推荐

