()
| 30 | }; |
| 31 | |
| 32 | const 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 |
no test coverage detected