Skip to content

GOOGLE_SDK_NODE_LOGGING error on edge function #484

Description

@JetUni

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

The function is throwing an error that was previously not there. It does not get to the Deno.serve portion of the code in the example below

To Reproduce

import 'jsr:@supabase/functions-js/edge-runtime.d.ts';
import { sheets } from 'npm:@googleapis/sheets';
import { JWT } from 'npm:google-auth-library';

// Create a new JWT client using the credentials
console.log('Creating Google JWT client');
const googleAuthJwt = new JWT({
  email: Deno.env.get('GOOGLE_SHEETS_API_CLIENT_EMAIL'),
  key: Deno.env.get('GOOGLE_SHEETS_API_PRIVATE_KEY'),
  scopes: ['https://www.googleapis.com/auth/spreadsheets'],
});

// Authorize and create a Google Sheets API instance
console.log('Connecting to Google Sheets API with JWT client');
const sheetsApi = sheets({ version: 'v4', auth: googleAuthJwt });

Deno.serve(async (req) => {
  return new Response('OK');
});

Expected behavior

A response is returned from the function

System information

  • OS: Windows & GH Action
  • Version of supabase-js: 2
  • Version of Node.js: 20.17.0

Additional context

Error message I'm getting

{
  "event_message": "event loop error: TypeError: Cannot read properties of undefined (reading 'GOOGLE_SDK_NODE_LOGGING')\n    at Object.log (file:///var/tmp/sb-compile-edge-runtime/node_modules/localhost/google-logging-utils/0.0.2/build/src/logging-utils.js:356:36)\n    at Object.<anonymous> (file:///var/tmp/sb-compile-edge-runtime/node_modules/localhost/gcp-metadata/6.1.1/build/src/index.js:52:20)\n    at Object.<anonymous> (file:///var/tmp/sb-compile-edge-runtime/node_modules/localhost/gcp-metadata/6.1.1/build/src/index.js:409:4)\n    at Module._compile (node:module:731:34)\n    at Module._extensions..js (node:module:745:10)\n    at Module.load (node:module:656:32)\n    at Module._load (node:module:524:12)\n    at Module.require (node:module:675:19)\n    at require (node:module:790:16)\n    at Object.<anonymous> (file:///var/tmp/sb-compile-edge-runtime/node_modules/localhost/google-auth-library/9.14.0/build/src/auth/googleauth.js:31:21)",
  "id": "01d2fcd5-340d-42b6-85a5-0c477ed3b84c",
  "metadata": [
    {
      "boot_time": null,
      "cpu_time_used": null,
      "deployment_id": "box..._..._68",
      "event_type": "UncaughtException",
      "execution_id": "f6c241a9-65d7-4c2a-907f-f497b36cb441",
      "function_id": "...",
      "level": "error",
      "memory_used": [],
      "project_ref": "...",
      "reason": null,
      "region": "us-west-1",
      "served_by": "supabase-edge-runtime-1.66.5 (compatible with Deno v1.45.2)",
      "timestamp": "2025-02-02T15:34:11.110Z",
      "version": "68"
    }
  ],
  "timestamp": 1738510454102522
}

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions