clerk/javascript

Support Fastify v5

Closed this issue · 3 comments

Preliminary Checks

Reproduction

Publishable key

pk_test_Zml0dGluZy15YWstOTguY2xlcmsuYWNjb3VudHMuZGV2JA

Description

When installing fastify v5, the backend immediately crashes with the following error:

[08:51:11 UTC] ERROR: fastify-plugin: @clerk/fastify - expected '4.x' fastify version, '5.0.0' is installed
    err: {
      "type": "FastifyError",
      "message": "fastify-plugin: @clerk/fastify - expected '4.x' fastify version, '5.0.0' is installed",
      "stack":
          FastifyError: fastify-plugin: @clerk/fastify - expected '4.x' fastify version, '5.0.0' is installed
      "code": "FST_ERR_PLUGIN_VERSION_MISMATCH",
      "name": "FastifyError",
      "statusCode": 500
    }

Environment

-

Having the same issue

Hi, thanks for the issue. The error comes from

export const clerkPlugin = fp(plugin, {
name: '@clerk/fastify',
fastify: '4.x',
});
so it's expected to happen. Currently the plugin is only compatible with Fastify v4.

The migration guide is here for reference: https://fastify.dev/docs/latest/Guides/Migration-Guide-V5/

For example, they now require Node.js 20 whereas the Clerk package allows 18.17.0 or later. So we'll need to cut a new major version in doing this upgrade. We'll work on it 👍

Support for Fastify v5 has been added in @clerk/fastify@2.0.0. Please note that it's not backwards-compatible with Fastify v4, you will have to use Fastify v5.