Closed rommanio closed 7 months ago
Good morning!
Do you have an example application so we can reproduce the issue?
Yes, we can provide it.
https://github.com/rommanio/sample-nuxt-unit-app
You can build and run it by docker compose -f docker/docker-compose.yml build && docker compose -f docker/docker-compose.yml up
.
@javorszky please give it a try to check whats the issue. Feel free to invite other to join the research.
I've been debugging for the past hour and a bit. I have an idea where / why it hangs, but haven't found the concrete issue yet. I'll keep everyone updated once I either get stuck and need more answers or found a resolution :)
@rommanio we found a possible cause for this. Testing whether that's causing it and trying to fix it.
@rommanio we found a possible cause for this. Testing whether that's causing it and trying to fix it.
Good news. Thank you! :)
@rommanio I've opened a PR to fix this issue that I tested locally: https://github.com/nginx/unit/pull/1020
Here's how you can test the same changesets on your end:
unit-http
into your sample repository's docker
folder. I had that local copy as ./docker/unit-http
. This is so the local files can be copied into the dockerfilemodify the dockerfile so it looks like this:
FROM unit:1.31.1-node20
#COPY --chown=unit . /var/www/
RUN mkdir -p /builder
COPY . /builder
COPY docker/unit-http /lib/unit-http
WORKDIR /builder
RUN npm i --progress=false
RUN npm run build
RUN mkdir -p build && cp -r .output/server build/
RUN npm run generate
RUN cp -r .output/public build/
RUN cp -r build /var/www/
RUN chown -R unit:unit /var/www
RUN chmod +x /var/www/server/index.mjs
WORKDIR /var/www/server
notable changes:
/lib/
folder inside the dockerfilearguments
part to this:
"arguments": [
"node",
"--loader",
"/lib/unit-http/loader.mjs",
"--require",
"/lib/unit-http/loader",
"index.mjs"
],
notable changes:
/lib/...
volumes:
- ./unit.json:/docker-entrypoint.d/config.json
this way the image doesn't need to be rebuilt if we're only making configuration changes
./docker/unit-http/loader.js
and ./docker/unit-http/loader.mjs
files so they add the new lines that are in the pull request.That fixed the issue for me.
Could you please also include short description in docs/changes.xml
(for release purposes), since this change is visible for users.
Something like:
diff --git a/docs/changes.xml b/docs/changes.xml
--- a/docs/changes.xml
+++ b/docs/changes.xml
@@ -40,6 +40,13 @@ with Next.js.
</para>
</change>
+<change type="bugfix">
+<para>
+Node.js module name rules, notable for Node.js Nuxt applications.
+</para>
+</change>
+
+
</changes>
We have infrastructure with many PHP applications. A part of these applications we're running in Nginx Unit. We have external developers who develop Nuxt application. We want to unify our infrastructure and use Unit everywhere. But when we trying to build Nuxt application and run it in Unit (as documented here, in Unit documentation),
curl
stucks on Unit port, but on Node port, 3000,curl
works normally.