KnpLabs / KnpLabs/server-side-renderer
Incorrect default implementation of /app/scripts/postRender.js
- Dominant language
- JavaScript
- Stars
- 14
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
The service does not work at all when setting up a docker container following the instructions in `README.md`. All requests will return a `500 Internal Server Error` with the following error message logged:
```
The script provided doesn't set the script variable as a valid function.
```
This is because there is an incorrect implementation of the file `/app/scripts/postRender.js`. This script does not contain any code.
If I create a file with the following code:
```javascript
script = function () {}
```
And mount it as a volume to `/app/scripts/postRender.js`, then everything will work as expected.
Nowhere in the documentation is there any mention that a proper postRender script is strictly required.
I see three possible solutions:
1) The file `/app/scripts/postRender.js` should be removed. The server should be able to start without it. An example file should be placed somewhere else.
2) The server should not fail if the script is empty.
3) An empty default implementation should be made, like the code I used above.
I would suggest the first solution. But if there is any technical aspect that make this tricky, then the other two solutions would also be okay.
Contributor guide
Research direction
Start with README.md and /app/scripts/postRender.js, then reproduce the Docker setup described in the issue to confirm the 500 error and logged message. Check how the empty script is loaded and determine which of the three proposed behaviors allows the server to start without a valid custom postRender function. Done means the documented default setup works without mounting a replacement script.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, javascript
- Domain
- backend, devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100