fastify-dx icon indicating copy to clipboard operation
fastify-dx copied to clipboard

Fastify v4 Support

Open seSze opened this issue 2 years ago • 3 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.0.3

Plugin version

No response

Node.js version

16

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

Monterey

Description

It appears fastify-static requires version 3.x of fastify

❯ yarn build && yarn start
yarn run v1.22.17
warning package.json: No license field
$ npm run build:client && npm run build:server

> build:client
> vite build --outDir dist/client --ssrManifest

vite v2.9.12 building for production...
✓ 54 modules transformed.
dist/client/assets/logo.cc50e266.svg         6.08 KiB
dist/client/index.html                       0.31 KiB
dist/client/ssr-manifest.json                2.07 KiB
dist/client/assets/client-only.53046d16.js   0.67 KiB / gzip: 0.43 KiB
dist/client/assets/index.38341194.js         1.55 KiB / gzip: 0.70 KiB
dist/client/assets/server-only.59b389c3.js   0.62 KiB / gzip: 0.40 KiB
dist/client/assets/streaming.ac73764e.js     0.59 KiB / gzip: 0.37 KiB
dist/client/assets/using-auth.6c7bd58d.js    1.24 KiB / gzip: 0.73 KiB
dist/client/assets/using-store.c395d616.js   1.07 KiB / gzip: 0.65 KiB
dist/client/assets/using-data.cf228474.js    1.29 KiB / gzip: 0.75 KiB
dist/client/assets/index.aa422626.css        2.68 KiB / gzip: 0.81 KiB
dist/client/assets/index.b29a6f0d.js         97.19 KiB / gzip: 37.57 KiB

> build:server
> vite build --outDir dist/server --ssr /index.js

vite v2.9.12 building SSR bundle for production...
transforming (16) assets/logo.svg"defineAsyncComponent" is imported from external module "vue" but never used in "../../../../../dx:core.js", "client/pages/client-only.vue", "client/pages/server-only.vue", "client/pages/using-store.vue", "client/pages/using-data.vue", "client/pages/using-auth.vue", "client/pages/index.vue", "client/components/Message.vue", "client/pages/streaming.vue", "client/layouts/auth.vue", "client/layouts/default.vue", "../../../../../dx:layout.vue", "client/root.vue" and "../../../../../dx:create.js".
✓ 20 modules transformed.
dist/server/index.js   26.46 KiB
✨  Done in 1.95s.
yarn run v1.22.17
warning package.json: No license field
$ node server.js

/Users/sebastian/code/playground/fastify-vue/node_modules/fastify/lib/pluginUtils.js:118
    throw new FST_ERR_PLUGIN_VERSION_MISMATCH(meta.name, requiredVersion, this.version)
          ^
FastifyError [Error]: fastify-plugin: fastify-static - expected '3.x' fastify version, '4.0.3' is installed
    at Object.checkVersion (/Users/sebastian/code/playground/fastify-vue/node_modules/fastify/lib/pluginUtils.js:118:11)
    at Object.registerPlugin (/Users/sebastian/code/playground/fastify-vue/node_modules/fastify/lib/pluginUtils.js:133:16)
    at Boot.override (/Users/sebastian/code/playground/fastify-vue/node_modules/fastify/lib/pluginOverride.js:28:57)
    at Plugin.exec (/Users/sebastian/code/playground/fastify-vue/node_modules/avvio/plugin.js:80:33)
    at Boot.loadPlugin (/Users/sebastian/code/playground/fastify-vue/node_modules/avvio/plugin.js:273:10)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'FST_ERR_PLUGIN_VERSION_MISMATCH',
  statusCode: 500
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Steps to Reproduce

Run yarn build && yarn start on fresh install

Expected Behavior

No response

seSze avatar Jun 20 '22 22:06 seSze

Thank you! I'm working to resolve Fastify v3/v4 compatibility issues now — next release for both dx-react and dx-vue should be updated to Fastify v4, but I'm investigating how costly it can be (if at all) to maintain a working version for v3 as well.

I'll update this issue when it's out.

galvez avatar Jun 20 '22 22:06 galvez

For now, if you want to play with it, lock Fastify to v3 in package.json.

galvez avatar Jun 20 '22 22:06 galvez

you need any help with that?

seSze avatar Jun 21 '22 00:06 seSze