I have a worker that transforms html in output from a proxied heroku app. Code is mostly a straightforward modification of the HTMLRewriter example. It just happens that the script crashes returning error 500 ca. 20% of the runs. It apparently happens on css files, because the net effect on the app is that sometimes the css don’t load and the console reports http error 500 on css files.
The workers are attached to the route site.com/*
and only process text/html and, trying with curl, the server returns the correct content-type.
Code excerpt:
if (contentType.startsWith('text/html')) {
return rewriter.transform(res);
} else {
return res;
}
I’m somewhat stuck because I can’t really understand what’s happening because I could not find any way to have a log from the workers (so I can understand which request causes the problem).
Any hint is appreciated