Node project adding a partial creates a server 500 error, ot is it me?

I have created a partial which is top menu.

All good and viewing the partial in Wappler is as expected when looking at the partial file I created in the Project folder on the left.

I add the partial to the page and it does not show in Wappler and when viewing in the Browser I get a 500 Error?

Tried restarting and still same error.

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

I take the partial out and no 500 error.

Are partials supported in node projects this way?

Tried moving the partial include and still no joy.

Can you share a screenshot of your browser when you see this error?

Sure - Chrome

Same in Firefox

I also get the same error when I create a page with a layout.

Use a layout 500 error, but don’t apply the layout works fine.

Tried restarting Wappler, the service but still the 500 error.

Do you have any server action included on the page? If yes, please enable the debug option in server connect settings.

No server actions in the page.

Just basic show and hide variable and class toggle.

With debug on same 500 error

What’s the partial content? What’s the layout page content?

OK do you wont me to send you the files?

One is nav menu top the other is a large multi step form.

I have tested the partial nav on a blank page and it works.

But it doesn’t like something in the form page, but I get no errors and only using in page variables

Ah ha!

I was able to recreate and maybe something I am missing or a bug

so the path of the test page is /admin/partialtest.ejs

Adding the partial from:

administration_side_menu

This creates a 500 error.

However If I create a page in the top level and then add the partial menu as above it works.

Either I am not allowed to do this or the partial is not working when it is added in a sub folder?

The partials must be created/saved in the Partials folder. The same way as layouts are in the layouts folder:

Screenshot_20

You can’t just store a partial in some random folder.

I didn’t and it is not the partial is in the partial folder here:

Yeah I get it can’t be in some “random” folder, maybe learning but not stupid!

So to be completely clear:

The partial is in the partial folder as shown clearly above!

The content page is is admin/mypage.ejs

The partial is added in the content page:

500 error.

1 Like

Thanks for the clarification. I was able to recreate the error when the content page is in a subfolder and you add a partial to it :slight_smile: Nice bug catch!
@george will check this and we will fix it in the next update.

1 Like

As a temporary fix you can edit the partial path and add / in front of it like:

<%- await include('/partials/partial1', Object.assign({}, locals, )) %>

Thanks @Teodor this didn’t work, but this did and likley just the file location up another level.

<%- await include('../partials/administration_top_menu', Object.assign({}, locals, )) %>

2 posts were split to a new topic: Error with partial in NodeJS

This is improved in Wappler 3.4.0 now

An absolute link to /partials is always used - so no matter where your partial is located it works.