freddy38510 / quasar-app-extension-ssg

Static Site Generator App Extension for Quasar.
MIT License
155 stars 16 forks source link

Build succeedes but process hangs forever, making it impossible to deploy with netlify #109

Closed barnabastoth closed 2 years ago

barnabastoth commented 2 years ago

Dear Freddy/Quasar team

First of all thank you for your amazing work, this plugin is a life saver. There is only 1 issue which prevents me from using it in production.

When I start a build process (quasar ssg generate) it builds perfectly fine, but the process seem to hang forever, which makes it so that Netlify can not move into the 2nd phase of deploying the generated files to their CDN. Is there a way to maybe manually hang the process in the after generation hook? Or is this a bug that you might be able to help me with?

Here is my package.json "dependencies": { "@quasar/extras": "^1.0.0", "awesome-phonenumber": "^2.64.0", "babel-loader": "^8.2.3", "clipboard": "^2.0.8", "core-js": "^3.6.5", "isomorphic-ws": "^4.0.1", "quasar": "^2.0.0", "simpleddp": "^2.2.4", "simpleddp-plugin-login": "^4.0.2", "vue-lite-youtube-embed": "^1.0.1", "vue-recaptcha": "^2.0.1", "vue3-carousel": "^0.1.30", "vue3-json-viewer": "^1.0.4" }, "devDependencies": { "@babel/eslint-parser": "^7.13.14", "@quasar/app": "^3.0.0", "eslint": "^7.14.0", "eslint-config-standard": "^16.0.2", "eslint-plugin-import": "^2.19.1", "eslint-plugin-node": "^11.0.0", "eslint-plugin-promise": "^5.1.0", "eslint-plugin-vue": "^7.0.0", "eslint-webpack-plugin": "^2.4.0", "netlify-cli": "^6.14.19", "pug": "^3.0.2", "pug-plain-loader": "^1.1.0", "quasar-app-extension-ssg": "^3.1.1" },

here is the end of the build process log

9:41:13 AM: Extension(ssg) • ❯ Beastcss[info]: Processed in 91 ms 9:41:13 AM: Extension(ssg) • DONE • Pages generated with success • 148229ms 9:41:13 AM: App • Added build artifact "/opt/build/repo/dist/ssg" 9:41:13 AM: Generate succeeded 9:41:13 AM: Pkg quasar........ v2.3.4 9:41:13 AM: Pkg @quasar/app... v3.2.5 9:41:13 AM: Debugging......... enabled 9:41:13 AM: SPA fallback...... 404.html 9:41:13 AM: ================== 9:41:13 AM: Output folder..... /opt/build/repo/dist/ssg 9:41:13 AM: Tip: You can use "$ quasar ssg serve dist/ssg" command to create 9:41:13 AM: a static web server for testing. Type "$ quasar ssg serve -h" for parameters.

And its stuck like this forever.

The same thing happens on my pc in linux.

Here is the log for "quasar info" for my pc, but since the same happens on netlify I believe it is not an environment issue.

[exworm@exworm-pc puregoldprotein-frontend]$ quasar info

Operating System - Linux(5.15.6-arch2-1-surface) - linux/x64 NodeJs - 14.18.1

Global packages NPM - 6.14.15 yarn - 1.22.17 @quasar/cli - 1.2.2 @quasar/icongenie - 2.4.2 cordova - Not installed

Important local packages quasar - 2.3.4 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time @quasar/app - 3.2.5 -- Quasar Framework local CLI @quasar/extras - 1.12.2 -- Quasar Framework fonts, icons and animations eslint-plugin-quasar - Not installed vue - 3.2.24 -- The progressive JavaScript framework for buiding modern web UI. vue-router - 4.0.12 vuex - Not installed electron - Not installed electron-packager - Not installed electron-builder - Not installed @babel/core - 7.16.0 -- Babel compiler core. webpack - 5.65.0 -- Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff. webpack-dev-server - 4.6.0 -- Serves a webpack app. Updates the browser on changes. workbox-webpack-plugin - Not installed register-service-worker - 1.7.2 -- Script for registering service worker, with hooks typescript - 4.4.2 -- TypeScript is a language for application scale JavaScript development @capacitor/core - Not installed @capacitor/cli - Not installed @capacitor/android - Not installed @capacitor/ios - Not installed

Quasar App Extensions quasar-app-extension-ssg - 3.1.1 -- Static Site Generator App Extension for Quasar.

freddy38510 commented 2 years ago

Hi @barnabastoth I really appreciate that you find this extension useful.

I tried to replicate the issue on linux with a clean install and latest versions of quasar packages, but without success.

This could be from old cached files from previous builds with older versions of the extension. You can try running the quasar clean command to be sure.

barnabastoth commented 2 years ago

Hey Freddy

Thanks for the quick response.

If I add process.exit(0) to the afterGenerate hook, everything is working and I am able to deploy to netlify, tho I guess this is not the perfect solution.

I will try quasar clean once I get home. The issue has to be on my side, but im not quite sure what. I just added your extension to another quasar project of mine and the process exits properly, eventho the two project has the same quasar + extension version.

Is there a way to debug this more?

Thanks again for your work, you are a lifesaver:)

freddy38510 commented 2 years ago

From what you said I'm suspecting the beforeBuild hook. Are you opening some connections to a database ?

I just found two Node.js functions that should be helpful for debugging: process._getActiveHandles() and process._getActiveRequests().

You could run these functions in the afterGenerate hook. There are also some packages that use these functions and can give you more clues like why-is-node-running.

barnabastoth commented 2 years ago

I am connecting to a Meteor server with the simple-ddp package to get the IDS to generate the routes, it is a socket connection, but I do receive the data and everything correctly. Dont quote me on this, I will verify but I believe I also tried to remove the beforeBuild hook and the issue was the same.

Tomorrow I will try those functions and get back to you, thank you

freddy38510 commented 2 years ago

Might be a WebSocket connection still open.

Are you calling the disconnect method at the end of the beforeBuild hook ?

Do you connect to your Meteor server at server-side when the pages are pre-rendered ?

freddy38510 commented 2 years ago

@barnabastoth,

By the way, if the goal of your beforeBuild hook usage is to get a list of IDS to generate an array of dynamic routes, you don't have to since the crawler feature will take care of dynamic routes.

Any news about your issue ?