Skip to content

Releases: connectrpc/connect-es

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

v0.7.0

03 Feb 17:12
4f5fac3
Compare
Choose a tag to compare

This is the first release of Connect for Node.js - clients and servers for Node.js, with support for the gRPC, gRPC-web and Connect's own protocol: @bufbuild/connect-node

Connect-Node is still in preview, so we want your feedback! We’d love to learn about your use cases and what you’d like to do with Connect-Node. For example, do you plan to use it with React, Remix, or on the edge with Vercel’s Edge Runtime? You can reach us either through the Buf Slack or by filing a GitHub issue and we’d be more than happy to chat!

This release does not make any changes to @bufbuild/connect-web or the code generator protoc-gen-connect-web.

v0.6.0

06 Jan 21:41
8c32fa5
Compare
Choose a tag to compare

This release includes the following:

🚨 Breaking Changes 🚨

  • #370 - The Connect protocol now specifies that a header be set specifying the version of Connect in use. The header name is Connect-Protocol-Version and Connect-Web has been updated to send this header in its requests. As a result, users will need to make sure their CORS settings allowlist this new header, or all Connect requests will fail with this release.

    For more information, see this PR: https://github.com/bufbuild/connect-go/pull/416

Enhancements