Custom server terminated by NextJS after the SurrealDB client lost connection with the DB.
Unanswered
Zyrenth posted this in #help-forum
ZyrenthOP
Hello there 👋, I'm facing this problem when NextJS terminates the server after the [SurrealDB Client](https://www.npmjs.com/package/surrealdb.js) loses connection with the [SurrealDB Server](https://surrealdb.com/).
I'm running a custom server so I have a backend and I don't want to separate NextJS and the API.
I never ran NextJS with a custom/backend server and this is my first time trying, so far everything went fine until I implemented the DB connection.
After some debugging I found out that NextJS is causing this and it doesn't throw any error and it exits with code 0.
I couldn't find anything about this as I'm pretty sure that not many people run NextJS with a backend.
I have tried using older versions of the DB client but it didn't help at all. I also tried to init NextJS after the DB has connected but it didn't help as well. I don't know why it's doing this because it doesn't throw any error at all (as I mentioned it before).
I'm hoping that I can get help here. I also don't know if this is a bug in NextJS or it's intended to behave like this.
System info:
I'm running a custom server so I have a backend and I don't want to separate NextJS and the API.
I never ran NextJS with a custom/backend server and this is my first time trying, so far everything went fine until I implemented the DB connection.
After some debugging I found out that NextJS is causing this and it doesn't throw any error and it exits with code 0.
I couldn't find anything about this as I'm pretty sure that not many people run NextJS with a backend.
I have tried using older versions of the DB client but it didn't help at all. I also tried to init NextJS after the DB has connected but it didn't help as well. I don't know why it's doing this because it doesn't throw any error at all (as I mentioned it before).
I'm hoping that I can get help here. I also don't know if this is a bug in NextJS or it's intended to behave like this.
System info:
Operating System:
Platform: linux
Arch: x64
Version: #93-Ubuntu SMP Tue Sep 5 17:16:10 UTC 2023
Binaries:
Node: 20.8.0
npm: 10.1.0
Yarn: N/A
pnpm: N/A
+ SurrealDB: 1.0.0
Relevant Packages:
next: 13.4.19
eslint-config-next: 13.4.19
react: 18.2.0
react-dom: 18.2.0
typescript: 5.2.2
+ surrealdb.js: 0.9.1
Next.js Config:
output: N/A