profile
viewpoint
Grant Timmerman grant @Google Earth http://grant.cm Google Engineer working on Serverless

googleapis/google-api-nodejs-client 8510

Google's officially supported Node.js client library for accessing Google APIs. Support for authorization and authentication with OAuth 2.0, API Keys and JWT (Service Tokens) is included.

google/clasp 2299

🔗 Command Line Apps Script Projects

googleapis/google-api-ruby-client 2244

REST client for Google APIs

GoogleCloudPlatform/functions-framework-nodejs 614

FaaS (Function as a service) framework for writing portable Node.js functions

GoogleCloudPlatform/hackathon-toolkit 216

GCP Hackathon Toolkit

GoogleCloudPlatform/functions-framework-python 108

FaaS (Function as a service) framework for writing portable Python functions

grant/20-Apps 54

📱Learning iOS development by creating 20 apps in 20 days.

cloudevents/sdk-python 46

Python SDK for CloudEvents

GoogleCloudPlatform/functions-framework 30

The Contract for Building New Function Frameworks

GoogleCloudPlatform/functions-framework-php 29

FaaS (Function as a service) framework for writing portable PHP functions

create barnchgrant/.github

branch : master

created branch time in 7 hours

created repositorygrant/.github

created time in 7 hours

pull request commentcloudevents/sdk-javascript

fix: add two type definitions to SCM and fix their parameters

Hey Lance, I'll try to answer some of the questions. TL;DR; Javascript users will get the same experience. TS developers and SDK developers will get better autocompletion and less code duplication.

Yes I think this could be ok. I am not too concerned about the filename changes. I don’t love the continuous tsc but I can live with it.

OK. Yeah it's sorta bothersome in the beginning, but it's really lightweight and provides a pretty good devX imo.

What I want to better understand is how an interface fits in. What is the filename?

So, right now we are generating .ts files with tsc on js files. The generated files are named *.d.ts, still .ts files. Tsc infers the types and generates declarations. Ctrl+click to see the definition of the types. OK autocompletion but not great. I know it's painful the first time you look at a .ts file with interfaces, but it's worth understanding interfaces.

A TypeScript interface provides structure to a plain old JavaScript object. It's used by editors like VS Code and others, even if you're using plain JavaScript. Some npm modules.

It affects the SDK code writing { id, source, type, dataContentType, time, subject, dataSchema, schemaURL, dataContentEncoding, data, specversion } multiple times (no wrapper class).

When we publish the npm module, we publish our code which has a package.json file. This file can have a types property. This types property is used by editors to view the types.

How does it affect (if at all) the way a pure JS developer interacts with the SDK? Do any of the other type definitions need to know about it? Etc.

It doesn't affect the pure JS end developer. Pure JS developers do however often use editors like VS Code that provides inference via TS. TypeScript does not attempt to force the JS world to type TypeScript, it's strictly optional because it is a strict language superset.

I meant what I said when I said #155 could be the start of a gradual movement towards TS. And I admit that this comes from ignorance on my part. But I don’t think that I would have been able to get a 2.0 release out as quickly as I did if I had to also be learning the machinations of typescript in the meantime.

Great. It's fine to have everyone learn and contribute to the project with their own perspectives and requirements.

I’m happy to start making that journey right now.

Great to hear.

lance

comment created time in 7 hours

Pull request review commentGoogleCloudPlatform/functions-framework

feat: add cloudevent signature

 In a different example, a service using the Functions Framework could have the u  ## Supported Function Types -The framework must support at least the HTTP and CloudEvents function types. In statically typed languages, the framework must include an additional function type whereby the user can define unmarshalling rules. These function types dictate:+The framework **must** support at least the `http` and `cloudevents` function types. The framework **may** support legacy-style `event` function types. In statically typed languages, the framework must include an additional function type whereby the user can define unmarshalling rules. These function types dictate:  - The steps taken by the framework in response to ingress requests - The function signatures which developers must adhere to when writing functions for use with a Functions Framework - The mechanism by which the developer signals that the function has completed performing useful work  The developer must signal the function's signature type to the framework. This enables the framework to take appropriate unmarshalling, invocation and completion signalling steps. -### HTTP Functions+### HTTP Functions (Signature Type: `http`)++The Functions Framework **must** support signature type `http`.  When the container receives an ingress request, the framework must invoke the developer's function by passing a language-idiomatic representation of HTTP objects as arguments to the function. These objects must enable the developer to perform common HTTP tasks, such as inspecting the request's content encoding or headers. These objects should be accurate representations of the HTTP request received by the execution environment (i.e., path, body and headers should not be modified before passing them to the user's function). -The developer's function must explicitly signal that it has completed performing useful work by sending a response to the Functions Framework. This response signals that the stateless container can be stopped.+### CloudEvents Functions (Signature Type: `cloudevents`) -### CloudEvents Functions+The Functions Framework **must** support signature type `cloudevents`.  When the container receives an ingress request, the framework must invoke the developer's function by passing an object corresponding to a [CloudEvents type](https://github.com/cloudevents/spec/blob/master/spec.md). This object does not expose HTTP semantics to the developer's function. The framework must handle unmarshalling HTTP requests into the CloudEvents object that is passed to the developer's function, and should support both [binary and structured content modes](https://github.com/cloudevents/spec/blob/master/http-protocol-binding.md#3-http-message-mapping) for incoming HTTP CloudEvent requests. -The developer's function must either explicitly or implicitly signal that it has completed performing useful work. The function may explicitly signal this condition by explicitly returning. The function may implicitly signal this condition by simply evaluating until it reaches the end of the function's code block.

Yeah, I think it should be kept, just not repeated 3 times. Will re-add it.

grant

comment created time in 8 hours

issue commentGoogleCloudPlatform/functions-framework-ruby

Do not override `functions-framework`

I'm not sure I fully understand the issue.

With Ruby, installing the gem gives the global command functions-framework. With Node, installing the package does not give the global command functions-framework. Right?

It's a problem when a FF takes the binary functions-framework given we have multiple FF languages.


I think we should change bin/functions-framework to bin/functions-framework-ruby in this repo and try to not name binaries functions-framework. If the Node FF can be globally invoked with functions-framework (without the scope of @google-cloud or use of npx), we should probably change the binary name there too.

@hdp617 It should probably be in the contract "make binaries unique among other FF languages". I don't understand the issue as much, do you want to create a PR?

grant

comment created time in 8 hours

pull request commentGoogleCloudPlatform/functions-framework

feat: add cloudevent signature

Pinged @grayside on Hangouts Chat.

grant

comment created time in 9 hours

pull request commentcloudevents/sdk-javascript

fix: add two type definitions to SCM and fix their parameters

@grant if you can put together a PR for that I would appreciate it. I think that will be easiest for me to understand how it all fits together, and to experiment with it from both a pure JS project and a pure TS project.

I'm happy to put a PR together if it will be accepted. However, I don't know if you understand what I'm suggesting. This would be my 3rd attempt at introducing .ts to CloudEvents, and I have moved on to other languages until we can solve this.

From a technical standpoint, I would like to ensure we understand:

  • We're OK with these filename change:
    • lib/cloudevent.js -> `"lib/cloudevent.ts"
    • lib/bindings/http/http_emitter.js -> lib/bindings/http/http_emitter.ts
  • We're OK with using a uniquely TypeScript feature, interface to support optional types in objects. Example: https://github.com/cloudevents/sdk-javascript/issues/184#issuecomment-632408537
  • We're willing to use continually use tsc --watch to continuously build .ts files into a .js files.

If we are not happy with those understandings, I can't see a technical way to solve this problem and can't contribute. if we're OK with that, I am free Friday to collaborate and put a PR together.

lance

comment created time in 10 hours

issue commentcloudevents/sdk-javascript

Generated type definitions don't declare optional parameters

Yes, sorry, that was a bit impolite, @lance. I've edited the comment. Still genuinely interested in seeing the technological though.

lance

comment created time in 10 hours

pull request commentcloudevents/sdk-javascript

fix: add two type definitions to SCM and fix their parameters

I'd imagine something like this:

constructor(cloudEvent: CloudEventV1 = SPEC_V1) {
 ...
}

In a cloudevent.ts file: https://github.com/cloudevents/sdk-javascript/blob/master/lib/cloudevent.js#L29


The source for CloudEventV1 would be something like this: https://github.com/cloudevents/sdk-javascript/issues/184#issuecomment-632408537

Unfortunately I don't think we can add optional types without changing the extension or manually creating types as suggested in this PR.

I'd rather rename the file extension as generated-then-hand-modified files are hard to keep up-to-date.

lance

comment created time in 10 hours

pull request commentcloudevents/sdk-javascript

fix: add two type definitions to SCM and fix their parameters

This is certainly one solution. Thanks for trying to get the types in here!

However I think a more elegant solution would just be to not create new files (.d.ts) that are hand-modified, and to just change the files to normal files (.ts without the (.d). By excluding certain .js files, it looks like we are manually creating these type definitions, which is not sustainable or conventional.

I think we can all agree that we shouldn't include generated files in source control. Happy to hear thoughts around this.

lance

comment created time in 10 hours

issue commentcloudevents/sdk-javascript

Generated type definitions don't declare optional parameters

This seems like a blocker for projects that use this library using TypeScript and require optional types. A solution would be to declare a CloudEvent interface with optional fields, but that obviously uses TypeScript which we can't have. Curious to see the solution.

lance

comment created time in 10 hours

startedcloudevents/sdk-python

started time in 11 hours

startedcloudevents/sdk-python

started time in 11 hours

issue openedcloudevents/sdk-python

Remove support for v0.2 v0.1 events

The SDK spec states we don't have to support v0.2 v0.1 versions. We should remove support and document current support here.

created time in 11 hours

issue commentGoogleCloudPlatform/dotnet-docs-samples

Add eventsforcloudrun samples

Asked Jon for a review.

grant

comment created time in a day

pull request commentGoogleCloudPlatform/functions-framework-dotnet

DRAFT: One possible approach for simpler errors.

Not sure if I am the best person to review these changes. Going to unassign, but feel free to ping me on docs or other non .NET specific changes.

jskeet

comment created time in a day

pull request commentGoogleCloudPlatform/ruby-docs-samples

Automl

Sorry, I am unfamiliar with this product and can't review here.

dizcology

comment created time in a day

issue commentcloudevents/spec

Re-org the repo

Here are a couple links:

  • https://help.github.com/en/github/building-a-strong-community/setting-guidelines-for-repository-contributors
  • https://github.com/rhysd/dot-github/tree/master/.github

So even more top level files?

I would suggest grouping files in top-level folders and leave things like protocols/ and formats/ at the top level. If it makes sense to verbally say "Cloud Events spec protocols" or "Cloud Events spec formats", then we can mirror the file structure that way with cloudevents/spec protocols/.

duglin

comment created time in 2 days

issue commentcloudevents/spec

Re-org the repo

It seems like the goals are reducing the number of top-level files?

Thoughts:

  • Use .github/ folder for files like CONTRIBUTING.
  • Don't have a folder cloudevents/. We're already in the cloudevents org, spec repo. Rather flatten the folder so we can directly see the list of files.
  • Folders like artwork seem like they should be a link from the README to source files rather than a directory in the spec.
  • Other suggestions above look like an improvement 👍
duglin

comment created time in 2 days

push eventgrant/talks

Grant Timmerman

commit sha fab1c2530039c4e0249e47cf43f0516ea936ca18

Update README.md

view details

push time in 3 days

pull request commentGoogleCloudPlatform/functions-framework-java

Correctly resolve function runtime classpath in Maven plugin. Fixes #30

Hi @graemerocher, it looks like we could get a couple reviews for this framework. I've sent a review request to the main maintainer.

graemerocher

comment created time in 4 days

push eventgrant/dotfiles

Grant Timmerman

commit sha ec4ec4af04874b5a9539db8a8ff3c85048c83fee

No sublime, only VS Code

view details

push time in 4 days

startedf/omelette

started time in 4 days

issue openedgrant/dotfiles

Disable .DS_Store files

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Requires restart.

created time in 4 days

issue openedgrant/dotfiles

Performance: Remove unused global scripts

Occasionally remove all binaries to improve terminal performance:

sudo rm -rf /usr/local/bin

https://unix.stackexchange.com/a/8658

created time in 4 days

issue commentgrant/dotfiles

Move to ZSH

export PATH=/usr/local/bin:$PATH

grant

comment created time in 4 days

push eventgrant/dotfiles

Grant Timmerman

commit sha 0c399d50110ab93ad005d505825b7ac3e29007c7

Update .zshrc

view details

push time in 4 days

push eventgrant/dotfiles

Grant Timmerman

commit sha c23e8ee8d68ad874922ec400f5bf2f52d2a2ae67

Delete .bash_profile

view details

push time in 4 days

push eventgrant/dotfiles

Grant Timmerman

commit sha c758361e355de60db98edb188b556b4ac36b516b

Delete .git-branch.sh

view details

push time in 4 days

push eventgrant/dotfiles

Grant Timmerman

commit sha e8aef3a19b7a4ba945d28bf75bcfd2639ddc4f99

Delete .git-prompt.sh

view details

push time in 4 days

push eventgrant/dotfiles

Grant Timmerman

commit sha 7801b21f0392a588fc4ae2bb1668eab3656f01ce

Create .zshrc

view details

push time in 4 days

issue commentgrant/dotfiles

Move to ZSH

iterm > Settings > Profiles > Shell:

  • [x] Run comand: login -fpql timmerman /bin/zsh
  • When shell exits: Don't close the window
  • Ask before closing: Never
grant

comment created time in 5 days

issue commentgrant/dotfiles

Move to ZSH

touch ~/.hushlogin

grant

comment created time in 5 days

issue openedgrant/dotfiles

Move to ZSH

Rewrite .bash_profile to .zsh and change setup.

created time in 5 days

issue closedgoogleapis/google-api-nodejs-client

google calendar api - check if a calendar is being watched

is there an api for checking if a calendar is being watched? or getting s list of all watched calendars for my Google API project?

closed time in 5 days

zachi

issue commentgoogleapis/google-api-nodejs-client

google calendar api - check if a calendar is being watched

Hi Zachi, good question. Unfortunately, there is no API method that checks if a calendar is being watched. A consumer must manually track that information. It could also be a privacy issue to be able to see all information about various users watching a common calendar.

Only users with the right permission can create watch channels in the first place, so it shouldn't be an issue. When creating a channel, you specify a TTL, which defaults to 3600 seconds. You may also see a X-Goog-Channel-Expiration header, or you can manually stop the watch channel as ways to understand if a channel watch status has changed.

There is more information here: https://developers.google.com/calendar/v3/push

Hope that helps!

zachi

comment created time in 5 days

issue commentGoogleCloudPlatform/functions-framework-ruby

Do not override `functions-framework`

I don't think the Node FF adds a PATH for it's FF.

It's mainly an issue since I believe multiple FFs have these aliases (I know python has one) and will clash for users if they use multiple frameworks (like I observed).

I'll have to investigate more...

grant

comment created time in 6 days

PR opened GoogleCloudPlatform/functions-framework-nodejs

Reviewers
fix: do not err on process exit

Fixes: #22 #143

This change the behavior the process exit event handler. I don't know exactly why we have a latestRes modification here or if it's needed. I would assume a process exit does not need to send the latest HTTP response as an exit would not naturally happen.

Before

Serving function...
Function: function
URL: http://localhost:8080/
^CReceived SIGINT
Error: Process exited with code 0
    at process.<anonymous> (<folder>/node_modules/@google-cloud/functions-framework/build/src/invoker.js:396:29)
    at process.emit (events.js:203:13)
    at process.EventEmitter.emit (domain.js:471:20)
    at process.exit (internal/process/per_thread.js:158:15)
    at Server.<anonymous> (<folder>/node_modules/@google-cloud/functions-framework/build/src/invoker.js:402:29)
    at Object.onceWrapper (events.js:291:20)
    at Server.emit (events.js:203:13)
    at Server.EventEmitter.emit (domain.js:471:20)
    at emitCloseNT (net.js:1572:8)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)

After

Serving function...
Function: function
URL: http://localhost:8080/
^CReceived SIGINT
Process exited with code 0
+1 -1

0 comment

1 changed file

pr created time in 6 days

issue openedGoogleCloudPlatform/functions-framework-nodejs

Smooth Exit

The FF should smoothly exit, even with a process interrupt. This would create a better developer experience.

This is what a user sees when we CTRL-C:

Serving function...
Function: function
URL: http://localhost:8080/
^CReceived SIGINT
Error: Process exited with code 0
    at process.<anonymous> (<folder>/node_modules/@google-cloud/functions-framework/build/src/invoker.js:396:29)
    at process.emit (events.js:203:13)
    at process.EventEmitter.emit (domain.js:471:20)
    at process.exit (internal/process/per_thread.js:158:15)
    at Server.<anonymous> (<folder>/node_modules/@google-cloud/functions-framework/build/src/invoker.js:402:29)
    at Object.onceWrapper (events.js:291:20)
    at Server.emit (events.js:203:13)
    at Server.EventEmitter.emit (domain.js:471:20)
    at emitCloseNT (net.js:1572:8)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)

Source:

process.on('exit', code => {
  logAndSendError(new Error(`Process exited with code ${code}`), latestRes);
});

We're not really doing any good by logging the stacktrace of the Node process, maybe a one-liner error would be better.

created time in 6 days

issue openedGoogleCloudPlatform/functions-framework-ruby

Do not override `functions-framework`

I'm not sure if this is a ruby package manager issue or what exactly. I am getting a funny error:

I'm running my Node function:

 npx @google-cloud/functions-framework --target=helloWorld

However, I get this unrelated error:

npx @google-cloud/functions-framework --target=helloWorld
I, [2020-05-21T17:56:22.642045 #41868]  INFO -- : FunctionsFramework: Loading functions from "./app.rb"...
Traceback (most recent call last):
	4: from /Users/$USER/.rvm/gems/ruby-2.3.4/bin/functions-framework:23:in `<main>'
	3: from /Users/$USER/.rvm/gems/ruby-2.3.4/bin/functions-framework:23:in `load'
	2: from /Users/$USER/.rvm/gems/ruby-2.3.4/gems/functions_framework-0.1.1/bin/functions-framework:19:in `<top (required)>'
	1: from /Users/$USER/.rvm/gems/ruby-2.3.4/gems/functions_framework-0.1.1/lib/functions_framework/cli.rb:100:in `run'
/Users/$USER/.rvm/gems/ruby-2.3.4/gems/functions_framework-0.1.1/lib/functions_framework/cli.rb:100:in `load': cannot load such file -- ./app.rb (LoadError)

I'm using the Node FF, not ruby... ???


The fix:

gem uninstall functions_framework

Can we prevent this somehow?

created time in 6 days

issue commentcloudevents/sdk-javascript

CloudEvent JSON Autocompletion without Class Wrapper

To get this feature with the use of raw object, I suggest we have 1 .ts file that would have the following below.

No other files would need to be .ts files.

/**
 * The object interface for CloudEvents 1.0.
 * @see https://github.com/cloudevents/spec/blob/v1.0/spec.md
 */
export interface CloudEvent1 {
  // REQUIRED Attributes
  /**
   * [REQUIRED] Identifies the event. Producers MUST ensure that `source` + `id`
   * is unique for each distinct event. If a duplicate event is re-sent (e.g. due
   * to a network error) it MAY have the same `id`. Consumers MAY assume that
   * Events with identical `source` and `id` are duplicates.
   * @required Non-empty string. Unique within producer.
   * @example An event counter maintained by the producer
   * @example A UUID
   */
  id: string;
  /**
   * [REQUIRED] Identifies the context in which an event happened. Often this
   * will include information such as the type of the event source, the
   * organization publishing the event or the process that produced the event. The
   * exact syntax and semantics behind the data encoded in the URI is defined by
   * the event producer.
   * Producers MUST ensure that `source` + `id` is unique for each distinct event.
   * An application MAY assign a unique `source` to each distinct producer, which
   * makes it easy to produce unique IDs since no other producer will have the same
   * source. The application MAY use UUIDs, URNs, DNS authorities or an
   * application-specific scheme to create unique `source` identifiers.
   * A source MAY include more than one producer. In that case the producers MUST
   * collaborate to ensure that `source` + `id` is unique for each distinct event.
   * @required Non-empty URI-reference
   */
  source: string;
  /**
   * [REQUIRED] The version of the CloudEvents specification which the event
   * uses. This enables the interpretation of the context. Compliant event
   * producers MUST use a value of `1.0` when referring to this version of the
   * specification.
   * @required MUST be a non-empty string.
   */
  specversion: string;
  /**
   * [REQUIRED] This attribute contains a value describing the type of event
   * related to the originating occurrence. Often this attribute is used for
   * routing, observability, policy enforcement, etc. The format of this is
   * producer defined and might include information such as the version of the
   * `type` - see
   * [Versioning of Attributes in the Primer](primer.md#versioning-of-attributes)
   * for more information.
   * @required MUST be a non-empty string
   * @should SHOULD be prefixed with a reverse-DNS name. The prefixed domain dictates the
   *   organization which defines the semantics of this event type.
   * @example com.github.pull.create
   * @example com.example.object.delete.v2
   */
  type: string;

  /**
   * The following fields are optional.
   */

  /**
   * [OPTIONAL] Content type of `data` value. This attribute enables `data` to
   * carry any type of content, whereby format and encoding might differ from that
   * of the chosen event format. For example, an event rendered using the
   * [JSON envelope](./json-format.md#3-envelope) format might carry an XML payload
   * in `data`, and the consumer is informed by this attribute being set to
   * "application/xml". The rules for how `data` content is rendered for different
   * `datacontenttype` values are defined in the event format specifications; for
   * example, the JSON event format defines the relationship in
   * [section 3.1](./json-format.md#31-handling-of-data).
   */
  datacontenttype?: string;
  /**
   * [OPTIONAL] Identifies the schema that `data` adheres to. Incompatible
   * changes to the schema SHOULD be reflected by a different URI. See
   * [Versioning of Attributes in the Primer](primer.md#versioning-of-attributes)
   * for more information.
   * If present, MUST be a non-empty URI.
   */
  dataschema?: string;
  /**
   * [OPTIONAL] This describes the subject of the event in the context of the
   * event producer (identified by `source`). In publish-subscribe scenarios, a
   * subscriber will typically subscribe to events emitted by a `source`, but the
   * `source` identifier alone might not be sufficient as a qualifier for any
   * specific event if the `source` context has internal sub-structure.
   *
   * Identifying the subject of the event in context metadata (opposed to only in
   * the `data` payload) is particularly helpful in generic subscription filtering
   * scenarios where middleware is unable to interpret the `data` content. In the
   * above example, the subscriber might only be interested in blobs with names
   * ending with '.jpg' or '.jpeg' and the `subject` attribute allows for
   * constructing a simple and efficient string-suffix filter for that subset of
   * events.
   *
   * If present, MUST be a non-empty string.
   * @example "https://example.com/storage/tenant/container"
   * @example "mynewfile.jpg"
   */
  subject?: string;
  /**
   * [OPTIONAL] Timestamp of when the occurrence happened. If the time of the
   * occurrence cannot be determined then this attribute MAY be set to some other
   * time (such as the current time) by the CloudEvents producer, however all
   * producers for the same `source` MUST be consistent in this respect. In other
   * words, either they all use the actual time of the occurrence or they all use
   * the same algorithm to determine the value used.
   * @example "2020-08-08T14:48:09.769Z"
   */
  time?: Date | string;
  /**
   * [OPTIONAL] The event payload. This specification does not place any restriction
   * on the type of this information. It is encoded into a media format which is
   * specified by the datacontenttype attribute (e.g. application/json), and adheres
   * to the dataschema format when those respective attributes are present.
   */
  // tslint:disable-next-line:no-any
  data?: any | string | number | boolean | null;
  /**
   * [OPTIONAL] CloudEvents extension attributes.
   */
  // tslint:disable-next-line:no-any
  [key: string]: any;
}
grant

comment created time in 6 days

issue openedcloudevents/sdk-javascript

CloudEvent JSON Autocompletion without Class Wrapper

As a developer, I want to be able to have autocompletion for objects without having a wrapper class such as CloudEvent.

JavaScript objects are normal in Node development, and are preferred over classes.

image

import {CloudEvent} from 'cloudevents/v1';
const ce = {
    "specversion" : "1.0",
    "type" : "com.github.pull.create",
    "source" : "https://github.com/cloudevents/spec/pull",
    "subject" : "123",
    "id" : "A234-1234-1234",
    "time" : "2018-04-05T17:31:00Z",
    "comexampleextension1" : "value",
    "comexampleothervalue" : 5,
    "datacontenttype" : "text/xml",
    "data" : "<much wow=\"xml\"/>"
}: CloudEvent;
ce.

The : CloudEvent can be dropped off from user code and be inferred with normal usage if the developer doesn't like TypeScript.

Creating new CloudEvent(), new CloudEvent(), over and over is tedious. It's much easier to use JSON. I think most Node developers would agree.

How can we add this feature?

Related but not the same: #169

created time in 6 days

Pull request review commentgoogle/clasp

[WIP] Refactoring

+{

Remove file.

PopGoesTheWza

comment created time in 6 days

Pull request review commentgoogle/clasp

[WIP] Refactoring

+module.exports = {

Oh.

Only use gts. The file should be:

{
  "extends": "./node_modules/gts"
}

Any errors from this, we'll need to fix.

PopGoesTheWza

comment created time in 6 days

push eventgoogle/google-api-javascript-client

Tal Koren

commit sha 80d3457530eca89f87814f1f07f26441051d2788

Remove duplicated header

view details

Grant Timmerman

commit sha f04404d4d6ea5e4e7157f94c59c3c367e95ffd63

Merge pull request #604 from talkor/patch-1 Remove duplicated header

view details

push time in 6 days

pull request commentgoogle/google-api-javascript-client

Remove duplicated header

Thanks!

talkor

comment created time in 6 days

pull request commentgoogle/clasp

[WIP] Refactoring

Thanks for improving this project @PopGoesTheWza. I'm sorry about the lack of a replacement for me. If we're suggesting very large changes, such as modifying all files, I can chime in. My opinion is do not use lerna in this project.

A GitHub issue is best for discussions like this.

In this case, we're introducing tooling that is a very large change. Please see my comments about introducing other tooling. After making the change, since it affects the whole project, I can check it and you can proceed in community PR reviews like normal.

How does that sound?

PopGoesTheWza

comment created time in 6 days

Pull request review commentgoogle/clasp

[WIP] Refactoring

+module.exports = {

Follow gts: https://github.com/googleapis/google-api-nodejs-client/blob/master/.prettierrc.js

PopGoesTheWza

comment created time in 6 days

Pull request review commentgoogle/clasp

[WIP] Refactoring

+module.exports = {

Follow gts: https://github.com/googleapis/google-api-nodejs-client/blob/master/.eslintrc.json

PopGoesTheWza

comment created time in 6 days

Pull request review commentgoogle/clasp

[WIP] Refactoring

     "nyc": "^15.0.1",     "prettier": "^2.0.4",     "tmp": "^0.1.0",+    "type-fest": "^0.13.1",     "ts-node": "^8.10.1",-    "tslint": "^6.1.2"+    "tslint": "^6.1.2",+    "xo": "^0.30.0"

If you want a strict answer, then use gts: https://github.com/google/gts This is a Google project. Although there is no current maintainer, we must use Google conventions.

Follow the tooling in this repo and no more (no eslint, no xo): https://github.com/googleapis/google-api-nodejs-client/blob/master/package.json

PopGoesTheWza

comment created time in 6 days

issue commentcloudevents/sdk-javascript

Remove generated files from source control

A docs/ folder is simply not very node-like.

Feel free to look at the way any of the top npm packages document their modules for comparison: https://www.npmjs.com/browse/depended

grant

comment created time in 6 days

PR opened GoogleCloudPlatform/functions-framework

Reviewers
feat: add cloudevent signature

This PR formally adds support support to the CloudEvents format to the Functions Framework. This helps support future projects that use CloudEvents.

Current Function Frameworks support CloudEvents via HTTP signatures or the legacy style signatures data, context.

Fixes #25. R: @grayside @juliehockett CC: @ace-n

+22 -19

0 comment

1 changed file

pr created time in 6 days

issue openedGoogleCloudPlatform/functions-framework

Add formal support for CloudEvents vs non-CloudEvent-event signature

Add contract support for CloudEvent signature rather than just data, context signature.

created time in 6 days

issue closedGoogleCloudPlatform/functions-framework

Document list of error codes

The types of errors in the Function Frameworks should be described and standardized across languages. This should include 400 and 500 errors. 400s: 400 Bad requests, 404s, 405s method not allowed 500s: Internal errors seen by the Functions Framework

closed time in 6 days

grant

create barnchGoogleCloudPlatform/functions-framework

branch : grant-cloudevents

created branch time in 6 days

issue openedcloudevents/sdk-javascript

Remove generated files from source control

This PR https://github.com/cloudevents/sdk-javascript/pull/140 introduced 21,838 lines of mostly HTML/non-Cloud SDK code into master.

It introduces files not related to this repo: https://github.com/cloudevents/sdk-javascript/tree/master/docs/fonts

For example, these files were not hand-written and aren't expected to be added to source control: Screen Shot 2020-05-21 at 11 15 09

@lance can we use gh-pages instead for this or somehow not include these files in master? This is common for most projects. That's more common for docs and will create PRs that aren't as large. Or let's just use md files rather than HTML files.

created time in 7 days

pull request commentcloudevents/sdk-javascript

lib!: change CloudEvent to use direct object notation and get/set properties

I would really like no autogenerated files in source control. We can think of some other way to get the docs besides this. Not sure if others agree.

lance

comment created time in 7 days

delete branch GoogleCloudPlatform/nodejs-docs-samples

delete branch : grant_run_events_pubsub

delete time in 7 days

push eventGoogleCloudPlatform/nodejs-docs-samples

Grant Timmerman

commit sha 1fd4f1d450722fcb1fe953a9e8ff64fc195a10f6

feat: add run_events_pubsub (#1809) * feat: add run_events_pubsub Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: address PR issues Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: formalize CE function response Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: add base64 data Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * docs: remove bodyparser Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * docs: address comments about run events pubsub Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

view details

push time in 7 days

PR merged GoogleCloudPlatform/nodejs-docs-samples

feat: add run_events_pubsub cla: yes

Adds a minimal Events for Cloud Run for Pub/Sub triggers.

Similar to the existing Pub/Sub sample, but uses Events for Cloud Run directly. Worth having a separate sample (at least until GA).

Future samples will be prefixed with:

  • run_events_{trigger type}
  • run_events_pubsub
  • run_events_audit_logs_gcs
  • run_events_firestore ...etc.
+232 -0

7 comments

8 changed files

grant

pr closed time in 7 days

push eventGoogleCloudPlatform/nodejs-docs-samples

WhiteSource Renovate

commit sha 17b8c6af5aaae0bae5d98f6cc1d367a390362fbf

fix(deps): update dependency googleapis to v51 (#1821) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [googleapis](https://togithub.com/googleapis/google-api-nodejs-client) | dependencies | major | [`^50.0.0` -> `^51.0.0`](https://renovatebot.com/diffs/npm/googleapis/50.0.0/51.0.0) | | [googleapis](https://togithub.com/googleapis/google-api-nodejs-client) | devDependencies | major | [`^50.0.0` -> `^51.0.0`](https://renovatebot.com/diffs/npm/googleapis/50.0.0/51.0.0) | --- ### Release Notes <details> <summary>googleapis/google-api-nodejs-client</summary> ### [`v51.0.0`](https://togithub.com/googleapis/google-api-nodejs-client/blob/master/CHANGELOG.md#&#8203;5100-httpswwwgithubcomgoogleapisgoogle-api-nodejs-clientcomparev5000v5100-2020-05-13) [Compare Source](https://togithub.com/googleapis/google-api-nodejs-client/compare/v50.0.0...v51.0.0) ##### ⚠ BREAKING CHANGES - run the generator ([#&#8203;2096](https://togithub.com/googleapis/google-api-nodejs-client/issues/2096)) ##### Features - generate samples ([#&#8203;2056](https://www.github.com/googleapis/google-api-nodejs-client/issues/2056)) ([ea599ac](https://www.github.com/googleapis/google-api-nodejs-client/commit/ea599acb1a5adfdfe4efefdf701f19cc07963b70)) - run the generator ([#&#8203;2096](https://www.github.com/googleapis/google-api-nodejs-client/issues/2096)) ([a89ca06](https://www.github.com/googleapis/google-api-nodejs-client/commit/a89ca0677d79c3dd0376459de77bdad3118d3f44)) </details> --- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#GoogleCloudPlatform/nodejs-docs-samples).

view details

Grant Timmerman

commit sha a883e0e4264fd3fd088a39887e9cedbc3e7494bf

Merge branch 'master' into grant_run_events_pubsub

view details

push time in 7 days

issue commentGoogleCloudPlatform/nodejs-docs-samples

run/hello-broken Test Fails

Thanks for re-opening.

Even though this is a known issue by some people, I would still like to be able to track the state of the issue via some bug. I don't always re-check contribution guides before making PRs.

grant

comment created time in 7 days

push eventGoogleCloudPlatform/nodejs-docs-samples

sofisl

commit sha b73516359f787b98f78d8bbee878a14e15dadd1c

feat: change JS to satisfy Dataflow JS engine (#1808) Co-authored-by: F. Hinkelmann <franziska.hinkelmann@gmail.com>

view details

Ace Nassri

commit sha 9e7b9598a7119324cc688d98d525558e9fc4d5db

GCF cloudbuild.yaml: clarify "dir" + yarn -> npm (#1823)

view details

Grant Timmerman

commit sha 4447a72de783f5507f2f160db8e2e82f179b7534

Merge branch 'master' into grant_run_events_pubsub

view details

push time in 7 days

delete branch GoogleCloudPlatform/nodejs-docs-samples

delete branch : ace-n-patch-1

delete time in 7 days

push eventGoogleCloudPlatform/nodejs-docs-samples

Averi Kitsch

commit sha 8cd532c7f780788f1c0bfefd6949c2c0c61ded80

add markdown files (#1816)

view details

Grant Timmerman

commit sha a101b52132c4c675ce18426b091a61e34e641d7f

Merge branch 'master' into grant_run_events_pubsub

view details

push time in 8 days

Pull request review commentGoogleCloudPlatform/functions-framework-dotnet

Deployment documentation

+# Deployment++## Deploying locally++Your function can run locally either by starting it through Visual+Studio or by running `dotnet run` from the command line. If your+project contains multiple functions, you must specify which one you+want to host either via command line arguments or environment+variables. The port to serve on can also be specified via the+command line or environment variables.++See the [README](../README.md) for configuration details.++## Deploying to Cloud Run++Running the Functions Framework is equivalent to running a regular+ASP.NET Core application as far as infrastructure is concerned. This+means you can run functions on Cloud Run with ease.++There are detailed instructions for C# available as part of the+Cloud Run documentation:++- [Quickstart for C#](https://cloud.google.com/run/docs/quickstarts/build-and-deploy#c)+- [Codelab for C#](https://codelabs.developers.google.com/codelabs/cloud-run-hello-csharp/index.html)++The instructions apply to functions in exactly the same way as+normal, with the same Dockerfile configuration. The `PORT`+environment variable will be supplied by Cloud Run. If your project+contains multiple functions, the simplest approach is to specify an+environment variable in your Dockerfile, with a line like this:++```text+ENV FUNCTION_TARGET HelloFunctions.Function+```++## Deploying to Google Cloud Functions++> **NOTE:**  +> The `dotnet3` runtime is currently available on an "allow+> list" basis. Deployment will fail unless your project has been+> specifically included in the list.++Deployment to Google Cloud Functions is easy with the `gcloud`+command line. See the [general deployment+documentation](https://cloud.google.com/functions/docs/deploying/filesystem)+for more detailed information; this page is only intended to give simple+"getting started" instructions. In general, deploying a .NET+Functions Framework function follows the same procedure as deploying+a function written in every language. The .NET-specific aspects are:++- The runtime should be specified as `dotnet3`+- The entry point should be specified as the name of the function+  type, including namespace (e.g. `HelloFunctions.Function`)++The command line options are used to specify how the function is+triggered.++### HTTP functions++HTTP functions are deployed using `--trigger-http`. For example:++```text+gcloud functions deploy hello-functions --runtime dotnet3 --trigger-http --entry-point HelloFunctions.Function+```++On successful deployment, details of the deployed function will be+displayed, including the URL. Visit the URL in a browser to invoke+your function.++### Legacy event functions++When you deploy a function listening for a particular event, you+have to specify the *event trigger* as part of the deployment+(instead of `--trigger-http` as above).++**Sample triggers**++Replace any ***bold italic*** parts with your project ID, bucket name and so forth.++Trigger type             | Payload type   | Sample command line options+------------------------ | -------------- | --------------------------+Cloud Storage operation  | StorageObject  | --trigger-event google.storage.object.finalize --trigger-resource ***my-gcs-bucket***+Pub/Sub message          | PubSubMessage  | --trigger-topic ***my-pubsub-topic-id***+Firestore event          | FirestoreEvent | --trigger event providers/cloud.firestore/eventTypes/document.write --trigger-resource 'projects/***my-project***/databases/(default)/documents/***my-collection***/{document}'

Is there a dash missing? --trigger event.

jskeet

comment created time in 8 days

Pull request review commentGoogleCloudPlatform/functions-framework-dotnet

Deployment documentation

+# Deployment++## Deploying locally++Your function can run locally either by starting it through Visual+Studio or by running `dotnet run` from the command line. If your+project contains multiple functions, you must specify which one you+want to host either via command line arguments or environment+variables. The port to serve on can also be specified via the+command line or environment variables.++See the [README](../README.md) for configuration details.++## Deploying to Cloud Run++Running the Functions Framework is equivalent to running a regular+ASP.NET Core application as far as infrastructure is concerned. This+means you can run functions on Cloud Run with ease.++There are detailed instructions for C# available as part of the+Cloud Run documentation:++- [Quickstart for C#](https://cloud.google.com/run/docs/quickstarts/build-and-deploy#c)+- [Codelab for C#](https://codelabs.developers.google.com/codelabs/cloud-run-hello-csharp/index.html)++The instructions apply to functions in exactly the same way as+normal, with the same Dockerfile configuration. The `PORT`+environment variable will be supplied by Cloud Run. If your project+contains multiple functions, the simplest approach is to specify an+environment variable in your Dockerfile, with a line like this:++```text+ENV FUNCTION_TARGET HelloFunctions.Function+```++## Deploying to Google Cloud Functions++> **NOTE:**  +> The `dotnet3` runtime is currently available on an "allow

+1. This is a bit ominous.

jskeet

comment created time in 8 days

pull request commentGoogleCloudPlatform/functions-framework-dotnet

PROTOTYPE ONLY: Sample of how "replying to an event" might be handled.

Event replying sounds good. I really don't understand C# or have a history with library's structure so I can't provide a review. Design docs would be better for feedback.

jskeet

comment created time in 8 days

pull request commentgoogle/clasp

[WIP] Refactoring

@grant in #473 you mentioned lerna. Have you thought it some more?

I could set it up if you wish.

Tentative package list:

  1. clasp-core (a CommonJS library)
  2. clasp-cli (one or more CLI to use the clasp-core)
  3. ts2gas?
  4. ...
  5. profit

I really don't work on this library anymore. There is no point in using lerna, it's not worth it. Feel free to try it if you want.

PopGoesTheWza

comment created time in 8 days

pull request commentGoogleCloudPlatform/nodejs-docs-samples

feat: add run_events_pubsub

@grayside PTAL

grant

comment created time in 8 days

push eventGoogleCloudPlatform/nodejs-docs-samples

Grant Timmerman

commit sha 1e3a92ed0dd931f949e59d84a7c1720a809cc6bc

docs: address comments about run events pubsub Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

view details

push time in 8 days

Pull request review commentGoogleCloudPlatform/nodejs-docs-samples

feat: add run_events_pubsub

+# Events for Cloud Run – Pub/Sub tutorial++This sample shows how to create a service that processes Pub/Sub messages.++For more details on how to work with this sample read the [Google Cloud Run Node.js Samples README](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/run).++## Dependencies++* **express**: Web server framework.+* **mocha**: [development] Test running framework.+* **supertest**: [development] HTTP assertion test client.++## Quickstart++Create a Cloud Pub/Sub topic:++```sh+gcloud pubsub topics create my-topic+```++Create a Cloud Pub/Sub trigger:++```sh+gcloud alpha events triggers create pubsub-trigger \+--target-service cloudrun-events \+--type com.google.cloud.pubsub.topic.publish \+--parameters topic=my-topic+```++Deploy your Cloud Run service:++```sh+gcloud builds submit \+ --tag gcr.io/$(gcloud config get-value project)/cloudrun-events

Sounds good. Fixed.

grant

comment created time in 8 days

Pull request review commentGoogleCloudPlatform/nodejs-docs-samples

feat: add run_events_pubsub

+# Events for Cloud Run – Pub/Sub tutorial++This sample shows how to create a service that processes Pub/Sub messages.++For more details on how to work with this sample read the [Google Cloud Run Node.js Samples README](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/run).++## Dependencies++* **express**: Web server framework.+* **mocha**: [development] Test running framework.+* **supertest**: [development] HTTP assertion test client.++## Quickstart++Create a Cloud Pub/Sub topic:++```sh+gcloud pubsub topics create my-topic+```++Create a Cloud Pub/Sub trigger:++```sh+gcloud alpha events triggers create pubsub-trigger \+--target-service cloudrun-events \+--type com.google.cloud.pubsub.topic.publish \+--parameters topic=my-topic+```++Deploy your Cloud Run service:++```sh+gcloud builds submit \+ --tag gcr.io/$(gcloud config get-value project)/cloudrun-events+gcloud run deploy cloudrun-events \+ --image gcr.io/$(gcloud config get-value project)/cloudrun-events+ ```++## Test++Test your Cloud Run service by publishing a message to the topic: ++```sh+gcloud pubsub topics publish my-topic --message="Hello there"+```++You may observe the Run service receiving an event in Stackdriver Logs.

Fixed.

grant

comment created time in 8 days

Pull request review commentGoogleCloudPlatform/nodejs-docs-samples

feat: add run_events_pubsub

+# Events for Cloud Run – Pub/Sub tutorial

Maybe. How about we add CODEOWNERS after we have more than a couple samples.

grant

comment created time in 8 days

Pull request review commentGoogleCloudPlatform/nodejs-docs-samples

feat: add run_events_pubsub

+// Copyright 2020 Google LLC. All rights reserved.+// Use of this source code is governed by the Apache 2.0+// license that can be found in the LICENSE file.++// [START run_events_pubsub_server_setup]+const express = require('express');+const app = express();+app.use(express.json());++// [END run_events_pubsub_server_setup]++// [START run_events_pubsub_handler]+app.post('/', (req, res) => {+  if (!req.body) {+    const msg = 'no Pub/Sub message received';+    res.status(400).send(`Bad Request: ${msg}`);+    return;+  }+  if (!req.body.message) {+    const msg = 'invalid Pub/Sub message format';+    res.status(400).send(`Bad Request: ${msg}`);+    return;+  }+  const pubSubMessage = req.body.message;+  const name = pubSubMessage.data+    ? Buffer.from(pubSubMessage.data, 'base64').toString().trim()+    : 'World';+  +  res.send(`Hello, ${name}! ID: ${req.get('ce-id') || ''}`);

All samples could eventually use a CE SDK when usable. None are useable besides Go.

grant

comment created time in 8 days

issue openedGoogleCloudPlatform/dotnet-docs-samples

Add eventsforcloudrun samples

Hi @meteatamel, We're starting to move our samples to language repos.

Can you make a PR to move to code here: https://github.com/gcpevents/eventsforcloudrun/pull/1

Into a new folder run/events: https://github.com/GoogleCloudPlatform/dotnet-docs-samples/tree/master/run

created time in 8 days

pull request commentgoogle/clasp

[WIP] Refactoring

I would use a Google tool since this is a Google project. See my comment. Ping me after the change

PopGoesTheWza

comment created time in 8 days

Pull request review commentgoogle/clasp

[WIP] Refactoring

     "nyc": "^15.0.1",     "prettier": "^2.0.4",     "tmp": "^0.1.0",+    "type-fest": "^0.13.1",     "ts-node": "^8.10.1",-    "tslint": "^6.1.2"+    "tslint": "^6.1.2",+    "xo": "^0.30.0"

Don't use xo, use Google's tool "gts" since this is a Google project.

PopGoesTheWza

comment created time in 8 days

Pull request review commentgoogle/clasp

[WIP] Refactoring

     "nyc": "^15.0.1",     "prettier": "^2.0.4",     "tmp": "^0.1.0",+    "type-fest": "^0.13.1",

I don't know why we need this, probably not needed with gts.

PopGoesTheWza

comment created time in 8 days

issue commentGoogleCloudPlatform/nodejs-docs-samples

run/markdown-preview/renderer Test Fails

Can we still keep the issue open? I don't check the contributing guides for issues that often and usually use GitHub issues for notifications and bug filing.

grant

comment created time in 8 days

issue commentGoogleCloudPlatform/nodejs-docs-samples

run/markdown-preview/renderer Test Fails

Yup. This issue can just track it then.

grant

comment created time in 8 days

issue openedGoogleCloudPlatform/nodejs-docs-samples

Slack Button Broken

I tried to go to the Slack room that linked on the README. However, the link is broken.

Here's the link: https://gcp-slack.appspot.com/

What's wrong?

created time in 8 days

push eventGoogleCloudPlatform/nodejs-docs-samples

Grant Timmerman

commit sha 9297a617ab05d4d3c02e2b5f61d36224781dc534

docs: remove bodyparser Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

view details

push time in 8 days

push eventGoogleCloudPlatform/nodejs-docs-samples

Grant Timmerman

commit sha 1a44ecd713c3d9ba8e40e499ff04386931ee84b5

feat: add run events gcs event snippet Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

view details

push time in 8 days

push eventGoogleCloudPlatform/nodejs-docs-samples

Grant Timmerman

commit sha 8ed1437fa7dac261dba7cac4a958fc2ef1d88b10

fix: add base64 data Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

view details

push time in 8 days

pull request commentGoogleCloudPlatform/nodejs-docs-samples

feat: add run_events_pubsub

I've created GitHub issues for unrelated failing tests.

grant

comment created time in 8 days

issue openedGoogleCloudPlatform/nodejs-docs-samples

run/markdown-preview/renderer Test Fails

The run/markdown-preview/renderer tests fail on master.

This failure makes this PRs's test fail: #1809

I'm not sure what's going on and don't have access to logs. It makes changes to unrelated PRs fail.

CC: @grayside

created time in 8 days

issue openedGoogleCloudPlatform/nodejs-docs-samples

run/markdown-preview/editor Test Fails

The run/markdown-preview/editor tests fail on master.

This failure makes this PRs's test fail: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/pull/1809

I'm not sure what's going on and don't have access to logs. It makes changes to unrelated PRs fail.

CC: @grayside

created time in 8 days

issue openedGoogleCloudPlatform/nodejs-docs-samples

run/hello-broken Test Fails

The run/hello-broken tests fail on master.

This failure makes this PRs's test fail: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/pull/1809

I'm not sure what's going on and don't have access to logs. It makes changes to unrelated PRs fail.

CC: @grayside

created time in 8 days

push eventGoogleCloudPlatform/nodejs-docs-samples

Grant Timmerman

commit sha 945e49039c7b249e6f7b9c26cda254e9ffb27c07

fix: formalize CE function response Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

view details

push time in 8 days

push eventGoogleCloudPlatform/nodejs-docs-samples

Grant Timmerman

commit sha 59a2b1baa57c591767067ac76b8758886ac2c8b9

fix: address PR issues Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

view details

Grant Timmerman

commit sha 5ebd594ecd0afd8618e5a2f64610db164ce7d422

Merge branch 'grant_run_events_pubsub' of github.com:GoogleCloudPlatform/nodejs-docs-samples into grant_run_events_pubsub

view details

push time in 8 days

pull request commentGoogleCloudPlatform/nodejs-docs-samples

feat: add run_events_pubsub

Grant, the failure for markdown-preview-renderer is likely because a CL was submitted to enable testing of a work-in-progress sample, but that sample has not yet been merged.

OK. Please advise on how to proceed. It's really hard to understand the PR test status if master is failing.

grant

comment created time in 9 days

Pull request review commentGoogleCloudPlatform/nodejs-docs-samples

feat: add run_events_pubsub

+# Events for Cloud Run – Pub/Sub tutorial++This sample shows how to create a service that processes Pub/Sub messages.++For more details on how to work with this sample read the [Google Cloud Run Node.js Samples README](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/run).++## Dependencies++* **express**: Web server framework.+* **body-parser**: express middleware for request payload processing.+* **mocha**: [development] Test running framework.+* **supertest**: [development] HTTP assertion test client.++## Quickstart++```sh+gcloud pubsub topics create my-topic++gcloud alpha events triggers create pubsub-trigger \+--target-service cloudrun-events \+--type com.google.cloud.pubsub.topic.publish \+--parameters topic=my-topic++gcloud builds submit \+ --tag gcr.io/$(gcloud config get-value project)/"$MY_RUN_CONTAINER"+gcloud run deploy "$MY_RUN_SERVICE" \

Yes. I have updated this accordingly.

grant

comment created time in 9 days

Pull request review commentGoogleCloudPlatform/nodejs-docs-samples

feat: add run_events_pubsub

+// Copyright 2019 Google LLC. All rights reserved.+// Use of this source code is governed by the Apache 2.0+// license that can be found in the LICENSE file.++// [START run_events_pubsub_server_setup]+const express = require('express');+const bodyParser = require('body-parser');

Oh, thanks.

grant

comment created time in 9 days

Pull request review commentGoogleCloudPlatform/nodejs-docs-samples

feat: add run_events_pubsub

+// Copyright 2019 Google LLC. All rights reserved.+// Use of this source code is governed by the Apache 2.0+// license that can be found in the LICENSE file.++// [START run_events_pubsub_server_setup]+const express = require('express');+const bodyParser = require('body-parser');+const app = express();++app.use(bodyParser.json());+// [END run_events_pubsub_server_setup]++// [START run_events_pubsub_handler]+app.post('/', (req, res) => {+  if (!req.body) {+    const msg = 'no Pub/Sub message received';+    res.status(400).send(`Bad Request: ${msg}`);+    return;+  }+  if (!req.body.message) {+    const msg = 'invalid Pub/Sub message format';+    res.status(400).send(`Bad Request: ${msg}`);+    return;+  }+  const pubSubMessage = req.body.message;+  const name = pubSubMessage.data+    ? Buffer.from(pubSubMessage.data, 'base64').toString().trim()+    : 'World';+  +  res.send({

Yup, I formalized the responses in the design doc a bit. Need to update it here.

grant

comment created time in 9 days

Pull request review commentGoogleCloudPlatform/nodejs-docs-samples

feat: add run_events_pubsub

+# Events for Cloud Run – Pub/Sub tutorial++This sample shows how to create a service that processes Pub/Sub messages.++For more details on how to work with this sample read the [Google Cloud Run Node.js Samples README](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/run).++## Dependencies++* **express**: Web server framework.+* **body-parser**: express middleware for request payload processing.+* **mocha**: [development] Test running framework.+* **supertest**: [development] HTTP assertion test client.++## Quickstart++```sh

Good point. Added some instructions.

grant

comment created time in 9 days

Pull request review commentGoogleCloudPlatform/nodejs-docs-samples

feat: add run_events_pubsub

+# Events for Cloud Run – Pub/Sub tutorial++This sample shows how to create a service that processes Pub/Sub messages.++For more details on how to work with this sample read the [Google Cloud Run Node.js Samples README](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/run).++## Dependencies++* **express**: Web server framework.+* **body-parser**: express middleware for request payload processing.+* **mocha**: [development] Test running framework.+* **supertest**: [development] HTTP assertion test client.++## Quickstart++```sh+gcloud pubsub topics create my-topic++gcloud alpha events triggers create pubsub-trigger \+--target-service cloudrun-events \+--type com.google.cloud.pubsub.topic.publish \+--parameters topic=my-topic++gcloud builds submit \+ --tag gcr.io/$(gcloud config get-value project)/"$MY_RUN_CONTAINER"+gcloud run deploy "$MY_RUN_SERVICE" \+ --image gcr.io/$(gcloud config get-value project)/"$MY_RUN_CONTAINER" \+ --allow-unauthenticated # Note: The "allowed unauthenticated requests" flag is not needed in production.

Good point. I've removed it.

grant

comment created time in 9 days

more