Describe the bug
The plugin @orama/plugin-data-persistence is currently not compatible with Next.js 14 when used on the server. It looks like the Node.js-environment is not correctly detected, therefore some logic reserved to Deno gets executed, thus leading to a crash.
The specific location is in a switch statement in server.ts.
This error happens during runtime when the module gets loaded or during build time.
A quick workaround is to use package-patch and comment-out the relevant statement. But this doesn't work in a monorepo setup due to limitations of package-patch.
To Reproduce
- Setup Next.js application (version 14 or newer)
- Install Orama +
@orama/plugin-data-persistence
- Import
restoreFromFile from @orama/plugin-data-persistence/server in a server-side function (or RSC)
- See error
Expected behavior
Import & usage of module doesn't crash due to invalid Deno-detection.
Environment Info
OS: MacOS 14.3.1
Node: 21.6.2
Orama: 2.0.8
Plugin: 2.0.7
Affected areas
Initialization
Additional context
https://github.com/askorama/orama/blob/8e5e8ef1b74281b90680c4713f849ab5c5f96d57/packages/plugin-data-persistence/src/server.ts#L71
Describe the bug
The plugin
@orama/plugin-data-persistenceis currently not compatible with Next.js 14 when used on the server. It looks like the Node.js-environment is not correctly detected, therefore some logic reserved to Deno gets executed, thus leading to a crash.The specific location is in a switch statement in
server.ts.This error happens during runtime when the module gets loaded or during build time.
A quick workaround is to use
package-patchand comment-out the relevant statement. But this doesn't work in a monorepo setup due to limitations ofpackage-patch.To Reproduce
@orama/plugin-data-persistencerestoreFromFilefrom@orama/plugin-data-persistence/serverin a server-side function (or RSC)Expected behavior
Import & usage of module doesn't crash due to invalid Deno-detection.
Environment Info
Affected areas
Initialization
Additional context
https://github.com/askorama/orama/blob/8e5e8ef1b74281b90680c4713f849ab5c5f96d57/packages/plugin-data-persistence/src/server.ts#L71