Nuxt Production Build Never Finished with Express MySql Session Store

silverbackdan
87
silverbackdan
commented 7 months ago

Version

v2.4.3

Reproduction link

https://codesandbox.io/s/z6o0ql1o03

Steps to reproduce

Go to the server control panel and try the 'build' command.

What is expected ?

The build should finish or an error message should show.

What is actually happening?

The build hangs after all files are compiled with no output explaining why this might be happening. The final line shows Entrypoint app = server.js server.js.map and I expect the build to finish there and the start command to run. The application can start successfully at that point it seems.

Additional comments?

I'm not sure which version this started happening in, but I'm going to start rolling back to previous versions of nuxt to try and see. I'm using the express server middleware as shown in the template and I just cannot figure out why this isn't working. It doesn't work even with valid mysql database connection credentials - I am using correct details in my local build and have checked that all the information resolves to a local mysql database that should accept the connection.

I'm thinking perhaps there is a promise that isn't resolving, but I am at a loss right now.

Any clues on how to best debug this and figure out what is happening would be hugely appreciated. I'm looking to get a website launched ASAP which this is preventing at the moment.

Thanks very much in advance!

bug
0
silverbackdan
87
silverbackdan
commented 7 months ago

The issue is still occurs if I roll back the package express-mysql-session to 2.0.1 which is one that was working in a previous project.

I then rolled back Nuxt to 2.3.4 with express-mysql-session ^2.1.0 - this build works

The issue was introduced in Nuxt 2.4.0 - it seems a lot of work was done on that release so perhaps it won't be the easiest to trace, but if there are any hints anyone could give that I could do to save package maintainers time in figuring this one out then I'm more than happy to do it.

Thanks!

0
Atinux
26.3k
Atinux
commented 7 months ago

Hi @silverbackdan

This issue is related to #4944 and fixed by #4958.

Actually the patch release is not published yet.

0
Timkor
6
Timkor
commented 7 months ago

In the mean time you can use this hook in your nuxt.config.js:

    hooks: {
        build: {
            done(builder) {
                if (!builder.nuxt.options.dev) {
                    setTimeout(() => process.exit(0), 1000);
                }
            }
        }
    },

This will close the build process in production.

0
silverbackdan
87
silverbackdan
commented 7 months ago

Thanks both! Shame it just missed the release, so close! haha. I'll keep an eye out though and use the fix suggested above for now.

0
manniL
5.8k
manniL
commented 7 months ago

Closing here as the next fix patch is coming soon, the workaround is present in nuxt-edge already and @Timkor provided a direct workaround ☺️

0
Informations
Bug ReportOpen
#c8689 - Created 7 months ago