From 94e5864e70aa1e20be7e2a70a6ef3daa05492177 Mon Sep 17 00:00:00 2001 From: feywind <57276408+feywind@users.noreply.github.com> Date: Thu, 20 Jun 2024 16:45:31 -0400 Subject: [PATCH 01/10] chore: update for linter failures From fbc880c0ecdee1b00e16eca7a055ba72024d4b5f Mon Sep 17 00:00:00 2001 From: feywind <57276408+feywind@users.noreply.github.com> Date: Thu, 20 Jun 2024 17:13:22 -0400 Subject: [PATCH 02/10] chore: first set of linter updates --- samples/openTelemetryTracing.js | 2 ++ samples/system-test/schema.test.ts | 4 ++-- samples/typescript/quickstart.ts | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/samples/openTelemetryTracing.js b/samples/openTelemetryTracing.js index dae84bdcf..1c0af995a 100644 --- a/samples/openTelemetryTracing.js +++ b/samples/openTelemetryTracing.js @@ -14,6 +14,8 @@ * limitations under the License. */ +/* eslint-disable n/no-process-exit */ + /** * This sample demonstrates how to add OpenTelemetry tracing to the * Google Cloud Pub/Sub API. diff --git a/samples/system-test/schema.test.ts b/samples/system-test/schema.test.ts index bbf192900..21e0753c7 100644 --- a/samples/system-test/schema.test.ts +++ b/samples/system-test/schema.test.ts @@ -31,8 +31,8 @@ import * as defer from 'p-defer'; import {TestResources} from './testResources'; import {commandFor} from './common'; -// Tests run as Node 12. -// eslint-disable-next-line node/no-unsupported-features/node-builtins +// Tests run as Node 14. +// eslint-disable-next-line n/no-unsupported-features/node-builtins import {promises as fs} from 'fs'; const execSync = (cmd: string) => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/samples/typescript/quickstart.ts b/samples/typescript/quickstart.ts index ff81eb791..c402f0a35 100644 --- a/samples/typescript/quickstart.ts +++ b/samples/typescript/quickstart.ts @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +/* eslint-disable n/no-process-exit */ + // sample-metadata: // title: Quickstart // description: A quick introduction to using the Pub/Sub client library. From 57a2871d82dbf0462235a5a8375dbc2941f62e6d Mon Sep 17 00:00:00 2001 From: feywind <57276408+feywind@users.noreply.github.com> Date: Thu, 20 Jun 2024 17:14:07 -0400 Subject: [PATCH 03/10] chore: update gapic tests --- test/gapic_publisher_v1.ts | 48 ++++++++++++++++----------------- test/gapic_schema_service_v1.ts | 48 ++++++++++++++++----------------- test/gapic_subscriber_v1.ts | 48 ++++++++++++++++----------------- 3 files changed, 72 insertions(+), 72 deletions(-) diff --git a/test/gapic_publisher_v1.ts b/test/gapic_publisher_v1.ts index f2254a188..8a15356f1 100644 --- a/test/gapic_publisher_v1.ts +++ b/test/gapic_publisher_v1.ts @@ -1237,9 +1237,9 @@ describe('v1.PublisherClient', () => { assert( (client.descriptors.page.listTopics.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -1285,9 +1285,9 @@ describe('v1.PublisherClient', () => { assert( (client.descriptors.page.listTopics.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -1328,9 +1328,9 @@ describe('v1.PublisherClient', () => { assert( (client.descriptors.page.listTopics.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -1370,9 +1370,9 @@ describe('v1.PublisherClient', () => { assert( (client.descriptors.page.listTopics.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); @@ -1822,9 +1822,9 @@ describe('v1.PublisherClient', () => { assert( (client.descriptors.page.listTopicSnapshots.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -1868,9 +1868,9 @@ describe('v1.PublisherClient', () => { assert( (client.descriptors.page.listTopicSnapshots.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -1907,9 +1907,9 @@ describe('v1.PublisherClient', () => { assert( (client.descriptors.page.listTopicSnapshots.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -1947,9 +1947,9 @@ describe('v1.PublisherClient', () => { assert( (client.descriptors.page.listTopicSnapshots.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); diff --git a/test/gapic_schema_service_v1.ts b/test/gapic_schema_service_v1.ts index cd96d3d23..0f29cc7e1 100644 --- a/test/gapic_schema_service_v1.ts +++ b/test/gapic_schema_service_v1.ts @@ -1502,9 +1502,9 @@ describe('v1.SchemaServiceClient', () => { assert( (client.descriptors.page.listSchemas.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -1550,9 +1550,9 @@ describe('v1.SchemaServiceClient', () => { assert( (client.descriptors.page.listSchemas.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -1593,9 +1593,9 @@ describe('v1.SchemaServiceClient', () => { assert( (client.descriptors.page.listSchemas.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -1635,9 +1635,9 @@ describe('v1.SchemaServiceClient', () => { assert( (client.descriptors.page.listSchemas.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); @@ -1802,9 +1802,9 @@ describe('v1.SchemaServiceClient', () => { assert( (client.descriptors.page.listSchemaRevisions.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -1848,9 +1848,9 @@ describe('v1.SchemaServiceClient', () => { assert( (client.descriptors.page.listSchemaRevisions.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -1891,9 +1891,9 @@ describe('v1.SchemaServiceClient', () => { assert( (client.descriptors.page.listSchemaRevisions.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -1931,9 +1931,9 @@ describe('v1.SchemaServiceClient', () => { assert( (client.descriptors.page.listSchemaRevisions.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); diff --git a/test/gapic_subscriber_v1.ts b/test/gapic_subscriber_v1.ts index 18c097733..7a8a738d2 100644 --- a/test/gapic_subscriber_v1.ts +++ b/test/gapic_subscriber_v1.ts @@ -2249,9 +2249,9 @@ describe('v1.SubscriberClient', () => { assert( (client.descriptors.page.listSubscriptions.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2295,9 +2295,9 @@ describe('v1.SubscriberClient', () => { assert( (client.descriptors.page.listSubscriptions.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2338,9 +2338,9 @@ describe('v1.SubscriberClient', () => { assert( (client.descriptors.page.listSubscriptions.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2378,9 +2378,9 @@ describe('v1.SubscriberClient', () => { assert( (client.descriptors.page.listSubscriptions.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); @@ -2544,9 +2544,9 @@ describe('v1.SubscriberClient', () => { assert( (client.descriptors.page.listSnapshots.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2590,9 +2590,9 @@ describe('v1.SubscriberClient', () => { assert( (client.descriptors.page.listSnapshots.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2633,9 +2633,9 @@ describe('v1.SubscriberClient', () => { assert( (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); @@ -2673,9 +2673,9 @@ describe('v1.SubscriberClient', () => { assert( (client.descriptors.page.listSnapshots.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); From d0f272afab3a8c2acc47ad5eb90143f46a0aaffb Mon Sep 17 00:00:00 2001 From: feywind <57276408+feywind@users.noreply.github.com> Date: Thu, 20 Jun 2024 17:38:27 -0400 Subject: [PATCH 04/10] chore: more linter fixes --- samples/quickstart.js | 2 ++ system-test/pubsub.ts | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/quickstart.js b/samples/quickstart.js index a5beb94bb..b1f296929 100644 --- a/samples/quickstart.js +++ b/samples/quickstart.js @@ -16,6 +16,8 @@ // look for the source TypeScript sample (.ts) for modifications. 'use strict'; +/* eslint-disable n/no-process-exit */ + // sample-metadata: // title: Quickstart // description: A quick introduction to using the Pub/Sub client library. diff --git a/system-test/pubsub.ts b/system-test/pubsub.ts index 4301292aa..ca152fda7 100644 --- a/system-test/pubsub.ts +++ b/system-test/pubsub.ts @@ -19,7 +19,6 @@ import defer = require('p-defer'); import * as uuid from 'uuid'; // This is only in Node 10.17+, but it's used for system tests, should be okay. -// eslint-disable-next-line node/no-unsupported-features/node-builtins import {promises as fs} from 'fs'; import { From a653fbd7e54f6a0b6403f4a1680faa7b23de662f Mon Sep 17 00:00:00 2001 From: feywind <57276408+feywind@users.noreply.github.com> Date: Fri, 21 Jun 2024 16:40:55 -0400 Subject: [PATCH 05/10] build: try going back to fix_hermetic for owlbot --- owlbot.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/owlbot.py b/owlbot.py index 0e82b17c5..08ad6f046 100644 --- a/owlbot.py +++ b/owlbot.py @@ -31,16 +31,17 @@ # We need to run this before the main owlbot processing, to make # sure quickstart.js gets gts fixed before the README is generated. # This needs to be worked out more properly, this is temporary. -logger.debug("Copy eslint config") -shell.run( - ["cp", "-r", f"/synthtool/node_modules", "."], - check=True, -) -logger.debug("Running fix...") -shell.run( - ["npm", "run", "fix"], - check=False, -) +#logger.debug("Copy eslint config") +#shell.run( +# ["cp", "-r", f"/synthtool/node_modules", "."], +# check=True, +#) +#logger.debug("Running fix...") +#shell.run( +# ["npm", "run", "fix"], +# check=False, +#) +node.fix_hermetic() node.owlbot_main(templates_excludes=[ 'src/index.ts', From deb73046fc18b943cb3d73e11441be397ce8060f Mon Sep 17 00:00:00 2001 From: feywind <57276408+feywind@users.noreply.github.com> Date: Fri, 21 Jun 2024 16:53:50 -0400 Subject: [PATCH 06/10] build: try using owlbot's copy of gts --- owlbot.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/owlbot.py b/owlbot.py index 08ad6f046..05c09d2ac 100644 --- a/owlbot.py +++ b/owlbot.py @@ -41,7 +41,19 @@ # ["npm", "run", "fix"], # check=False, #) -node.fix_hermetic() +logger.debug("Copy eslint config") +shell.run( + ["cp", "-r", f"/synthtool/node_modules", "."], + check=True, + hide_output=False, +) +logger.debug("Running fix...") +shell.run( + [f"/synthtool/node_modules/.bin/gts", "fix"], + check=False, + hide_output=False, +) +#node.fix_hermetic() node.owlbot_main(templates_excludes=[ 'src/index.ts', From 62374d5d0d04105253b1baa423023a7bf4885723 Mon Sep 17 00:00:00 2001 From: feywind <57276408+feywind@users.noreply.github.com> Date: Fri, 21 Jun 2024 17:04:54 -0400 Subject: [PATCH 07/10] build: try removing the separate fix pass entirely --- owlbot.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/owlbot.py b/owlbot.py index 05c09d2ac..c0f577641 100644 --- a/owlbot.py +++ b/owlbot.py @@ -41,18 +41,6 @@ # ["npm", "run", "fix"], # check=False, #) -logger.debug("Copy eslint config") -shell.run( - ["cp", "-r", f"/synthtool/node_modules", "."], - check=True, - hide_output=False, -) -logger.debug("Running fix...") -shell.run( - [f"/synthtool/node_modules/.bin/gts", "fix"], - check=False, - hide_output=False, -) #node.fix_hermetic() node.owlbot_main(templates_excludes=[ From 45898cfaeb8e5f98a4e3caade9ecbc0c90d537a1 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 21 Jun 2024 21:09:11 +0000 Subject: [PATCH 08/10] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 16 ++++++++-------- renovate.json | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 175f24bbb..db9aad469 100644 --- a/README.md +++ b/README.md @@ -66,15 +66,15 @@ npm install @google-cloud/pubsub ```javascript // Imports the Google Cloud client library -const {PubSub} = require('@google-cloud/pubsub'); +const { PubSub } = require("@google-cloud/pubsub"); async function quickstart( - projectId = 'your-project-id', // Your Google Cloud Platform project ID - topicNameOrId = 'my-topic', // Name for the new topic to create - subscriptionName = 'my-sub' // Name for the new subscription to create +projectId = 'your-project-id', // Your Google Cloud Platform project ID +topicNameOrId = 'my-topic', // Name for the new topic to create +subscriptionName = 'my-sub' // Name for the new subscription to create ) { // Instantiates a client - const pubsub = new PubSub({projectId}); + const pubsub = new PubSub({ projectId }); // Creates a new topic const [topic] = await pubsub.createTopic(topicNameOrId); @@ -84,19 +84,19 @@ async function quickstart( const [subscription] = await topic.createSubscription(subscriptionName); // Receive callbacks for new messages on the subscription - subscription.on('message', message => { + subscription.on('message', (message) => { console.log('Received message:', message.data.toString()); process.exit(0); }); // Receive callbacks for errors on the subscription - subscription.on('error', error => { + subscription.on('error', (error) => { console.error('Received error:', error); process.exit(1); }); // Send a message to the topic - topic.publishMessage({data: Buffer.from('Test message!')}); + topic.publishMessage({ data: Buffer.from('Test message!') }); } ``` diff --git a/renovate.json b/renovate.json index 26428fcfc..c5c702cf4 100644 --- a/renovate.json +++ b/renovate.json @@ -4,6 +4,7 @@ "docker:disable", ":disableDependencyDashboard" ], + "constraintsFiltering": "strict", "pinVersions": false, "rebaseStalePrs": true, "schedule": [ From d2c83528c9fb006cac260ab484986db6f70ded5b Mon Sep 17 00:00:00 2001 From: feywind <57276408+feywind@users.noreply.github.com> Date: Wed, 26 Jun 2024 21:24:07 +0000 Subject: [PATCH 09/10] build: clean up owlbot.py for changes in https://github.com/googleapis/synthtool/pull/1862/files --- .gitignore | 1 + owlbot.py | 26 +++----------------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index d4f03a0df..6e0935927 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /docs/ /out/ /build/ +samples/build/ system-test/secrets.js system-test/*key.json *.lock diff --git a/owlbot.py b/owlbot.py index c0f577641..0fd6e7f91 100644 --- a/owlbot.py +++ b/owlbot.py @@ -14,35 +14,15 @@ import synthtool.languages.node as node -# This code snippet can be used to manually update the typeless bot -# to a different version than OwlBot has baked in, but this shouldn't -# be needed once it's settled down. -import os -from synthtool import shell -from synthtool.log import logger -old_path = os.getcwd() -os.chdir("/synthtool") -logger.debug("Update typeless sample bot [1.3.0]") -shell.run(["npm", "i", "@google-cloud/typeless-sample-bot@1.3.0"]) -os.chdir(old_path) - +# Generate JS samples from TS. node.typeless_samples_hermetic() # We need to run this before the main owlbot processing, to make # sure quickstart.js gets gts fixed before the README is generated. # This needs to be worked out more properly, this is temporary. -#logger.debug("Copy eslint config") -#shell.run( -# ["cp", "-r", f"/synthtool/node_modules", "."], -# check=True, -#) -#logger.debug("Running fix...") -#shell.run( -# ["npm", "run", "fix"], -# check=False, -#) -#node.fix_hermetic() +node.fix() +# Main OwlBot processing. node.owlbot_main(templates_excludes=[ 'src/index.ts', '.github/PULL_REQUEST_TEMPLATE.md', From 94be0ef6cbda607912ccc60a692282fefaa958e4 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 26 Jun 2024 21:31:52 +0000 Subject: [PATCH 10/10] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index db9aad469..175f24bbb 100644 --- a/README.md +++ b/README.md @@ -66,15 +66,15 @@ npm install @google-cloud/pubsub ```javascript // Imports the Google Cloud client library -const { PubSub } = require("@google-cloud/pubsub"); +const {PubSub} = require('@google-cloud/pubsub'); async function quickstart( -projectId = 'your-project-id', // Your Google Cloud Platform project ID -topicNameOrId = 'my-topic', // Name for the new topic to create -subscriptionName = 'my-sub' // Name for the new subscription to create + projectId = 'your-project-id', // Your Google Cloud Platform project ID + topicNameOrId = 'my-topic', // Name for the new topic to create + subscriptionName = 'my-sub' // Name for the new subscription to create ) { // Instantiates a client - const pubsub = new PubSub({ projectId }); + const pubsub = new PubSub({projectId}); // Creates a new topic const [topic] = await pubsub.createTopic(topicNameOrId); @@ -84,19 +84,19 @@ subscriptionName = 'my-sub' // Name for the new subscription to create const [subscription] = await topic.createSubscription(subscriptionName); // Receive callbacks for new messages on the subscription - subscription.on('message', (message) => { + subscription.on('message', message => { console.log('Received message:', message.data.toString()); process.exit(0); }); // Receive callbacks for errors on the subscription - subscription.on('error', (error) => { + subscription.on('error', error => { console.error('Received error:', error); process.exit(1); }); // Send a message to the topic - topic.publishMessage({ data: Buffer.from('Test message!') }); + topic.publishMessage({data: Buffer.from('Test message!')}); } ```