• The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question SvelteKit and Plesk Node : TypeError: Cannot read properties of undefined (reading 'on')

MarcelP

New Pleskian
Server operating system version
Debian 10.13
Plesk version and microupdate number
18.0.58
I'm encountering an issue while deploying a SvelteKit demo application on a Plesk server. After following the steps to get the SvelteKit demo ready for production, I performed a build which resulted in two directories: client/ and server/ and some files. To start the application, I created an entry.cjs file with the following line:
(() => import('./index.js'))();

I then set this entry.cjs file as the startup file in the Node.js application settings on Plesk.
However, when I try to access the application via the browser, I receive the following error:
App 32610 output: server.server.on(
App 32610 output: ^
App 32610 output:
App 32610 output: TypeError: Cannot read properties of undefined (reading 'on')
App 32610 output: at file:///var/www/vhosts/programr.events/httpdocs/build/index.js:285:15

It seems this error is related to an attempt to access an on method on an undefined server object. Here are the steps I've taken for deployment:
  • Build the SvelteKit application using npm run build, which producesclient/ and server/ directories.
  • Creation of the entry.cjs file to start the application.
  • Configuring entry.cjs as the startup file on Plesk.
1709931745122.png

I'm a bit lost on how to resolve this issue. Has anyone encountered this error before, or does anyone have an idea on how to correctly configure a SvelteKit application for deployment on a Plesk server?

Thank you in advance for your help.
 
A couple years ago i've the same issue.

Easy fix. You need to add an file named index.cjs in the root directory from your domain /for example httpdocs_new with the content:
(() => import('./build/index.js'))();
And your configuration should look like this:
1737719149909.png
it its enough to upload your build folder to plesk. I recommend use git for that with an webhook setup.
 
Back
Top