Skip to content

Releases: connectrpc/connect-es

v0.10.0

14 Jun 19:43
b6187e9
Compare
Choose a tag to compare

What's Changed

KeepAlive

As of this release, Connect-ES offers Basic Keepalive support for HTTP/2 for clients that use one of the transports from @bufbuild/connect-node. Note that this replaces the option keepSessionAlive, which is deprecated with this PR.

In it's most simple form, the following example enables regular PINGs every 5 minutes:

import { createConnectTransport } from "@bufbuild/connect-node";

const transport = createConnectTransport({
  httpVersion: "2",
  baseUrl: "https://demo.connect.build",
  pingIntervalMs: 1000 * 60 * 5,
});

For more information, see #673

JSON parser ignores unknown fields by default

This release also changes the default behavior of the JSON parser so that unknown fields are ignored rather than rejected. Previously, Connect-ES followed the official guidance of the proto3 language spec and rejected unknown fields by default in parsing. However, this contradicts with the ethos that adding fields to a Protobuf definition should not be a breaking change. Therefore, the default behavior has been changed so any new/unknown fields are simply ignored.

Note that this could be considered a breaking change if consumers were relying on this rejection behavior.

Enhancements

  • Manage HTTP/2 connections and keep them alive with PING frames by @timostamm in #673
  • Ignore unknown JSON fields by default by @timostamm in #642
  • Modify parsing of response for Connect unary requests by @smaye81 in #668

Full Changelog: v0.9.1...v0.10.0

v0.9.1

30 May 17:28
a57540c
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.9.0...v0.9.1

v0.9.0

17 May 16:20
e85cf5c
Compare
Choose a tag to compare

What's Changed

As of this release, connect-es supports performing idempotent, side-effect free requests using HTTP GETs. This makes it easier to cache responses in the browser, on your CDN, or in proxies and other middleboxes.

Note
This functionality is only supported when using the Connect protocol—using a Connect client with a Connect server. When using any gRPC or gRPC-web client, including createGrpcTransport() and createGrpcWebTransport() from @bufbuild/connect-web or @bufbuild/connect-node, all requests will continue to be HTTP POSTs.

To opt into GET support for a given Protobuf RPC, you must mark it as being side-effect free using the MethodOptions.IdempotencyLevel option:

service ElizaService {
  rpc Say(stream SayRequest) returns (SayResponse) {
    option idempotency_level = NO_SIDE_EFFECTS;
  }
}

With this schema change, handlers will automatically support both GET and POST requests for this RPC. However, clients will continue to use POST requests by default, even when GETs are possible. To make clients use GETs for side effect free RPCs, set the useHttpGet option:

const transport = createConnectTransport({
  // ...
  useHttpGet: true
});

Another noteworthy change is the full support of timeouts, also known as deadlines in gRPC. For example, when a client provides the timeoutMs call option, a header Connect-Timeout-Ms is added to the request. The server parses this timeout, and if it takes longer than the given timeout to process the request, it should give up, and respond with the error code deadline_exceeded.

On a connect-es server, the parsed timeout is available as an AbortSignal on the context:

import type { HandlerContext } from "@bufbuild/connect";

const say = async (req: SayRequest, ctx: HandlerContext) => {

  ctx.signal.aborted; // true if timed out
  ctx.signal.reason; // an error with code deadline_exceed if timed out
  ctx.timeoutMs(); // the remaining time in milliseconds

  // raises an error with code deadline_exceed if timed out
  ctx.signal.throwIfAborted();

  // the AbortSignal can be passed to other functions
  await longRunning(ctx.signal);

  return new SayResponse({sentence: `You said: ${req.sentence}`});
};

Enhancements

  • Add client support for Connect HTTP GET requests by @jchadwick-buf in #620
  • Add server support for Connect HTTP GET requests by @jchadwick-buf in #624
  • Allow a fetch override for connect-web by @dimitropoulos in #618
  • Support timeouts in clients by @timostamm in #635
  • Support timeouts in handlers by @timostamm in #591
  • Update HandlerContext signal to trigger on other reasons than timeouts by @johynpapin in #531
  • Add a timeout getter to the HandlerContext and export createHandlerContext by @timostamm in #632
  • Add from() and findDetails() to ConnectError by @timostamm in #638
  • Always generate files when no services exist by @sjbarag in #598

Bugfixes

  • Fix UniversalHandlers resolving the response before headers are complete by @timostamm in #588
  • Improve tests for Node.js clients and fix hanging requests by @timostamm in #619
  • Indent "idempotency" in protoc-gen-connect-es by @timostamm in #626
  • Close the session on error in client transports by @timostamm in #623
  • Raise proper Connect error codes for closed streams in handlers by @timostamm in #628
  • Support client-side cancellation in the router transport by @timostamm in #637

Breaking changes

New Contributors

Full Changelog: v0.8.6...v0.9.0

v0.8.6

11 Apr 13:11
1dae4fa
Compare
Choose a tag to compare

connect-node

connect

Other changes

New Contributors

Full Changelog: v0.8.5...v0.8.6

v0.8.5

04 Apr 12:19
95b9de2
Compare
Choose a tag to compare

This release contains the following:

connect-node

Fixes

  • Abort HTTP/2 streams with RST_STREAM code CANCEL by @timostamm in #552.

connect

Enhancements

Fixes

  • Fix package definitions for Connect by @smaye81 in #553.
  • Avoid the AbortController constructor during init by @timostamm in #554.

Full Changelog: v0.8.4...v0.8.5

v0.8.4

15 Mar 19:54
8a8fdbd
Compare
Choose a tag to compare

If you are coming from v0.7.0 or earlier, make sure to take a look at the release notes of v0.8.0!

connect-next

We have officially added support for Next.js via the new @bufbuild/connect-next package! See the docs as well as #533 for more information.

connect-node

@bufbuild/connect-node now officially supports Node v19.

Fixes

  • Fix socket connect issue in Node 19 by @smaye81 in #532.
  • Fix unhandledRejection when aborting a server stream using @bufbuild/connect-node by @johynpapin in #530.

connect

Enhancements

Fixes

  • Fix the gRPC User-Agent header name by @timostamm in #525.
  • Add opt-in support for servers for the Connect-Protocol-Version header by @timostamm in #520.

New Contributors

  • @johynpapin made their first contribution in #530.

Full Changelog: v0.8.3...v0.8.4

v0.8.3

07 Mar 17:15
a453c23
Compare
Choose a tag to compare

If you are coming from v0.7.0 or earlier, make sure to take a look at the release notes of v0.8.0!

This release contains the following:

connect-fastify

Fixes

  • Fix response header management in Fastify plugin by @smaye81 in #517.

Full Changelog: v0.8.2...v0.8.3

v0.8.2

06 Mar 19:25
89d021d
Compare
Choose a tag to compare

If you are coming from v0.7.0 or earlier, make sure to take a look at the release notes of v0.8.0!

This release contains the following:

Connect for Node.js

Fixes

protoc-gen-connect-es

Fixes

  • Add @bufbuild/protobuf to dependencies by @fubhy in #496.

Full Changelog: v0.8.1...v0.8.2

v0.8.1

25 Feb 00:18
08f6d83
Compare
Choose a tag to compare

If you are coming from v0.7.0 or earlier, make sure to take a look at the release notes of v0.8.0!

Bugfixes

  • Fix: Revert to binary serialization by default for gRPC-web by @timostamm in #490

v0.8.0

23 Feb 18:25
006458e
Compare
Choose a tag to compare

This repository now hosts Connect for Web, but also for Node.js. We changed the name to Connect-ES to reflect the universal nature. As part of the reorganization, this release includes new features, but also some breaking changes.

Connect for Web

This is the first release that shares important bits of code between the web and the Node implementation, and comes with some bug fixes and new features:

  • Allow JSON in the gRPC-web transport of @bufbuild/connect-web #334
  • Emit unpadded base64 for binary headers #454
  • Way to recover from errors caused by non-compliant response body #469
  • Switch @bufbuild/connect-web to use @bufbuild/connect #471

If you are using Interceptors, please note the breaking change described in #471.

Otherwise, this release is backwards compatible, but we kindly ask you to install @bufbuild/connect, and import ConnectError and other types from there. In the future, @bufbuild/connect-web will only export the Connect and gRPC-web transports.

Connect for Node.js

The Handlers introduced in the preview are gone! With the new ConnectRouter, we can support more frameworks, and this release adds adapters for Express and Fastify:

  • Rename @bufbuild/connect-core to @bufbuild/connect #473
  • Add support for Express #479
  • Add support for Fastify #474
  • Polyfill headers in connect-node #462

If you have been using Connect for Node, please remove @bufbuild/connect-core, install @bufbuild/connect instead, and update your imports. See here how to use ConnectRouter with a Node.js server.

protoc-gen-connect-web

The code generator plugin has been renamed to @bufbuild/protoc-gen-connect-es. The old one is still available, so you don't have to update right away. See here how to update.

Other changes