• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

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