MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

run/idp-sql/index.js:32–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30};
31
32const main = async () => {
33 let project = process.env.GOOGLE_CLOUD_PROJECT;
34 if (!project) {
35 try {
36 project = await auth.getProjectId();
37 } catch (err) {
38 logger.error(`Error while retrieving Project ID: ${err}`);
39 }
40 }
41 initTracing(project); // pass project ID to tracing middleware
42 try {
43 await createTable(); // Create postgreSQL table if not found
44 } catch (err) {
45 const message =
46 'Error while connecting to the Cloud SQL database. ' +
47 'Check that your username and password are correct, that the Cloud SQL ' +
48 'proxy is running (locally), and that the PostgreSQL instance/database ' +
49 `exists and is ready for use: ${err}`;
50 logger.error(message);
51 }
52 startServer();
53};
54
55// [START cloudrun_sigterm_handler]
56// Clean up resources on shutdown

Callers 1

index.jsFile · 0.70

Calls 4

initTracingFunction · 0.85
createTableFunction · 0.85
getProjectIdMethod · 0.80
startServerFunction · 0.70

Tested by

no test coverage detected