Closed birdlavv closed 1 year ago
Any workaround/news?
currently https://github.com/vuejs/vuefire module needs the firebase-admin
package to provide SSR features. firebase-admin module internally uses jose
, due to which the builds fail at build time, it would be great to know any updates on this, or any possible workarounds.
The error is same as mentioned by the author, but here is the stack if anyone is intrested.
ERROR nitro 12:23:11
1: import * as http from 'http';
2: import * as https from 'https';
3: import { once } from 'events';
^
4: import { JOSEError, JWKSTimeout } from '../util/errors.js';
5: import { concat, decoder } from '../lib/buffer_utils.js';
ERROR 'once' is not exported by node_modules/.pnpm/unenv@1.0.0/node_modules/unenv/runtime/node/events/index.mjs, imported by node_modules/.pnpm/jose@4.11.2/node_modules/jose/dist/node/esm/runtime/fetch_jwks.js
at error (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:1858:30)
at Module.error (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:12429:16)
at Module.traceVariable (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:12788:29)
at ModuleScope.findVariable (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:11440:39)
at ReturnValueScope.findVariable (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:6372:38)
at ChildScope.findVariable (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:6372:38)
at Identifier.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:7439:40)
at CallExpression.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:5269:23)
at CallExpression.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:8935:15)
at ArrayExpression.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:5265:73)
at CallExpression.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:5265:73)
at CallExpression.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:8935:15)
at AwaitExpression.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:5269:23)
at VariableDeclarator.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:5269:23)
at VariableDeclaration.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:5265:73)
at BlockStatement.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:5265:73)
at ArrowFunctionExpression.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:5269:23)
at VariableDeclarator.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:5269:23)
at VariableDeclaration.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:5265:73)
at Program.bind (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:5265:73)
at Module.bindReferences (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:12425:18)
at Graph.sortModules (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:23062:20)
at Graph.build (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:22940:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:23730:13
at async catchUnfinishedHookActions (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:23126:20)
at async rollupInternal (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:23727:5)
at async _build (node_modules/.pnpm/nitropack@1.0.0/node_modules/nitropack/dist/shared/nitro.c8278d90.mjs:1404:18)
at async node_modules/.pnpm/nuxt@3.0.0_e3uo4sehh4zr4i6m57mkkxxv7y/node_modules/nuxt/dist/index.mjs:1677:9
at async build (node_modules/.pnpm/nuxt@3.0.0_e3uo4sehh4zr4i6m57mkkxxv7y/node_modules/nuxt/dist/index.mjs:2236:5)
at async Object.invoke (node_modules/.pnpm/nuxi@3.0.0/node_modules/nuxi/dist/chunks/build.mjs:56:5)
at async _main (node_modules/.pnpm/nuxi@3.0.0/node_modules/nuxi/dist/cli.mjs:50:20)
PR more than welcome 🙏🏼
sure, lemme try
Here is a workaround with Nuxt:
events
nuxt.config.ts
export default defineNuxtConfig({
hooks: {
'nitro:config': (nitroConfig) => {
nitroConfig.unenv = {
alias: {
events: require.resolve('events/'),
},
}
},
},
})
PR more than welcome 🙏🏼
@pi0 opened a PR with the fix #68
Reproduction steps
npm run build
The reproduction was made using
jose
package on a server-side api routevercel-edge
nitro presetcauses the following error: