ITADN

[🐞]Astro Actions in Qwik Astro not working in Netlify and other adapters

#251ClosedShane-Donlon 创建于 2025-04-30
S
Shane-Donloncommented
### Which component is affected? Integration ### Describe the bug Hey Jack ## Background So far from my testing this is not an issue in Vercel, but is an issue in Netlify & Node. When I deploy a site with Qwik Component and Astro Action Component in the same page the page fails. Of course due to Server Side Rendering it is only an issue on the pages that have the 2 components so the deploy doesn't fail but the page fails to load. Logs at end I was able to reproduce the issue locally also. If you change the adapter to node and run `npm run preview` you'll get the same error. I did some digging into this and found that the `globalThis` object seems to be "resetting" and so the `globalThis.qManifest` exists at build time but then is undefined again later. reference: https://github.com/QwikDev/astro/blob/main/libs/qwikdev-astro/server.ts#L88C11-L89C14 I know there's loads of reading in those logs. if you search the page for the below it'll help separate the logs. `10:05:52 [build] Complete!` So before the build is complete the qManifest reference is defined and all is good After this the qManifest reference no longer defined. Of course if we just remove the Astro Action all is good and Server Side Rendering works fine, just an issue when you introduce Astro Actions. *** ## Questions 1) More than happy to keep digging on this but I guess the first question is, is this behaviour from Astro expected? if it is expected we could have a look at using node to write to a `manifest.ts` file (as an export) when the qManifest context is being set in `index.ts` and then importing it into `server.ts` https://github.com/QwikDev/astro/blob/main/libs/qwikdev-astro/src/index.ts#L246 2) This is also an issue if we off-load the Action to a Qwik Button I know in the example reproduction it's not within a Qwik Component but if we offload this to a Qwik Button Component it is also an issue. *** ## Netlify Logs: ```terminal Apr 30, 10:02:34 AM: e055cfdd WARN Missing client manifest, loading symbols in the client might 404. Please ensure the client build has run and generated the manifest for the server build.Apr 30, 10:02:34 AM: e055cfdd ERROR serializeQRL: Cannot resolve symbol s_uJjbj6aZLDs in null undefinedApr 30, 10:02:34 AM: e055cfdd ERROR QWIK ERROR Code(31) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L39 s_uJjbj6aZLDs Error: Code(31) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L39 at createAndLogError (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:36:52) at logErrorAndStop (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:29:57) at qError (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:56:10) at serializeQRL (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3375:11) at file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3399:42 at mapJoin (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3112:16) at serializeQRLs (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3399:10) at renderNode (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:810:52) at processData$1 (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:862:16) at renderNode (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:827:21)Apr 30, 10:02:34 AM: e055cfdd ERROR Error in renderToStaticMarkup function of @qwikdev/astro: Error: Code(31) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L39 at createAndLogError (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:36:52) at logErrorAndStop (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:29:57) at qError (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:56:10) at serializeQRL (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3375:11) at file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3399:42 at mapJoin (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3112:16) at serializeQRLs (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3399:10) at renderNode (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:810:52) at processData$1 (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:862:16) at renderNode (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:827:21)Apr 30, 10:02:34 AM: e055cfdd ERROR Invoke Error {"errorType":"Error","errorMessage":"Code(31) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L39","stack":["Error: Code(31) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L39"," at createAndLogError (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:36:52)"," at logErrorAndStop (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:29:57)"," at qError (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:56:10)"," at serializeQRL (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3375:11)"," at file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3399:42"," at mapJoin (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3112:16)"," at serializeQRLs (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3399:10)"," at renderNode (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:810:52)"," at processData$1 (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:862:16)"," at renderNode (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:827:21)"]}Apr 30, 10:02:34 AM: e055cfdd ERROR Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: Code(31) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L39","reason":{"errorType":"Error","errorMessage":"Code(31) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L39","stack":["Error: Code(31) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L39"," at createAndLogError (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:36:52)"," at logErrorAndStop (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:29:57)"," at qError (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:56:10)"," at serializeQRL (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3375:11)"," at file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3399:42"," at mapJoin (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3112:16)"," at serializeQRLs (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:3399:10)"," at renderNode (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:810:52)"," at processData$1 (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:862:16)"," at renderNode (file:///var/task/.netlify/build/chunks/server_DJq4rvdW.mjs:827:21)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: Code(31) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L39"," at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)"," at process.emit (node:events:518:28)"," at emitUnhandledRejection (node:internal/process/promises:252:13)"," at throwUnhandledRejectionsMode (node:internal/process/promises:388:19)"," at processPromiseRejections (node:internal/process/promises:475:17)"," at process.processTicksAndRejections (node:internal/process/task_queues:106:32)"]}Apr 30, 10:02:34 AM: [ERROR] [1746003754438] LAMBDA_RUNTIME Failed to post handler success response. Http response code: 403.Apr 30, 10:02:34 AM: e055cfdd Duration: 1020.85 ms Memory Usage: 130 MB ``` ## Node Preview logs: ```terminal Formatted 14 files in 1626µs. No fixes applied. 10:05:51 [@astrojs/node] Enabling sessions with filesystem storage using deprecated parameters for the initialization function; pass a single object instead 10:05:51 [content] Syncing content 10:05:51 [content] Synced content 10:05:51 [types] Generated 35ms 10:05:51 [build] output: "server" 10:05:51 [build] mode: "server" 10:05:51 [build] directory: {dir location} 10:05:51 [build] adapter: @astrojs/node 10:05:51 [build] Collecting build info... 10:05:51 [build] ✓ Completed in 47ms. 10:05:51 [build] Building server entrypoints... 10:05:52 [vite] ✓ built in 899ms 10:05:52 [build] ✓ Completed in 927ms. building client (vite) 10:05:52 [vite] ✓ 22 modules transformed. 10:05:52 [vite] dist/client/build/q-bundle-graph-5k9uv7.json 0.10 kB │ gzip: 0.10 kB 10:05:52 [vite] dist/client/q-manifest.json 1.21 kB │ gzip: 0.53 kB 10:05:52 [vite] dist/client/qwik-prefetch-service-worker.js 3.92 kB 10:05:52 [vite] dist/client/_astro/root.CwaxZHJ-.js 4.22 kB │ gzip: 2.15 kB 10:05:52 [vite] dist/client/_astro/index.astro_astro_type_script_index_0_lang.DFmCVUEK.js 5.15 kB │ gzip: 2.37 kB 10:05:52 [vite] ✓ built in 151ms vite v5.4.19 building for production... ✓ 9 modules transformed. dist/client/build/q-bundle-graph-a4cvhm.json 0.19 kB │ gzip: 0.14 kB dist/client/qwik-prefetch-service-worker.js 3.91 kB dist/client/q-manifest.json 3.94 kB │ gzip: 0.90 kB dist/client/build/q-C0wSqufu.js 0.07 kB │ gzip: 0.08 kB dist/client/build/q-BrAM4vCM.js 0.09 kB │ gzip: 0.09 kB dist/client/build/q-CpQbVIF6.js 0.15 kB │ gzip: 0.15 kB dist/client/build/q-Da8PlD4L.js 0.17 kB │ gzip: 0.17 kB dist/client/build/q-CWC24MGm.js 0.21 kB │ gzip: 0.18 kB dist/client/build/q-C6A2sFBM.js 0.21 kB │ gzip: 0.18 kB dist/client/build/q-Cm-pRqbF.js 0.49 kB │ gzip: 0.34 kB dist/client/build/q-2LWRYvkK.js 1.16 kB │ gzip: 0.66 kB dist/client/build/q-DRCicbqM.js 85.85 kB │ gzip: 31.82 kB ✓ built in 294ms globalThis <ref *1> Object [global] { global: [Circular *1], clearImmediate: [Function: clearImmediate], setImmediate: [Function: setImmediate] { [Symbol(nodejs.util.promisify.custom)]: [Getter] }, clearInterval: [Function: clearInterval], clearTimeout: [Function: clearTimeout], setInterval: [Function: setInterval], setTimeout: [Function: setTimeout] { [Symbol(nodejs.util.promisify.custom)]: [Getter] }, queueMicrotask: [Function: queueMicrotask], structuredClone: [Function: structuredClone], atob: [Function: atob], btoa: [Function: btoa], performance: [Getter/Setter], fetch: [Function: fetch], navigator: [Getter], crypto: [Getter], Prism: { manual: undefined, disableWorkerMessageHandler: undefined, util: { encode: [Function: encode], type: [Function: type], objId: [Function: objId], clone: [Function: deepClone], getLanguage: [Function: getLanguage], setLanguage: [Function: setLanguage], currentScript: [Function: currentScript], isActive: [Function: isActive] }, languages: { plain: {}, plaintext: {}, text: {}, txt: {}, extend: [Function: extend], insertBefore: [Function: insertBefore], DFS: [Function: DFS], markup: [Object], html: [Object], mathml: [Object], svg: [Object], xml: [Object], ssml: [Object], atom: [Object], rss: [Object], css: [Object], clike: [Object], javascript: [Object], js: [Object] }, plugins: {}, highlightAll: [Function: highlightAll], highlightAllUnder: [Function: highlightAllUnder], highlightElement: [Function: highlightElement], highlight: [Function: highlight], tokenize: [Function: tokenize], hooks: { all: [Object], add: [Function: add], run: [Function: run] }, Token: [Function: Token] { stringify: [Function: stringify] } }, _astroGlobalDebug: [Function: debug], __extends: [Function: __extends], __assign: [Function: assign], __rest: [Function: __rest], __decorate: [Function: __decorate], __param: [Function: __param], __esDecorate: [Function: __esDecorate], __runInitializers: [Function: __runInitializers], __propKey: [Function: __propKey], __setFunctionName: [Function: __setFunctionName], __metadata: [Function: __metadata], __awaiter: [Function: __awaiter], __generator: [Function: __generator], __exportStar: [Function: __exportStar], __createBinding: [Function (anonymous)], __values: [Function: __values], __read: [Function: __read], __spread: [Function: __spread], __spreadArrays: [Function: __spreadArrays], __spreadArray: [Function: __spreadArray], __await: [Function: __await], __asyncGenerator: [Function: __asyncGenerator], __asyncDelegator: [Function: __asyncDelegator], __asyncValues: [Function: __asyncValues], __makeTemplateObject: [Function: __makeTemplateObject], __importStar: [Function: __importStar], __importDefault: [Function: __importDefault], __classPrivateFieldGet: [Function: __classPrivateFieldGet], __classPrivateFieldSet: [Function: __classPrivateFieldSet], __classPrivateFieldIn: [Function: __classPrivateFieldIn], __addDisposableResource: [Function: __addDisposableResource], __disposeResources: [Function: __disposeResources], __rewriteRelativeImportExtension: [Function: __rewriteRelativeImportExtension], astroAsset: { referencedImages: Set(0) {}, addStaticImage: [Function (anonymous)] }, qDev: false, qTest: true, qInspector: false, symbolMapperFn: [Function (anonymous)], '@astrojs/compiler': undefined, qManifest: { manifestHash: 'a4cvhm', symbols: { s_Nz00uvyHm9Y: [Object], s_pntIb7ZWkPs: [Object], s_uJjbj6aZLDs: [Object] }, mapping: { s_Nz00uvyHm9Y: 'q-Da8PlD4L.js', s_pntIb7ZWkPs: 'q-Cm-pRqbF.js', s_uJjbj6aZLDs: 'q-CpQbVIF6.js' }, bundles: { 'q-2LWRYvkK.js': [Object], 'q-BrAM4vCM.js': [Object], 'q-C0wSqufu.js': [Object], 'q-C6A2sFBM.js': [Object], 'q-Cm-pRqbF.js': [Object], 'q-CpQbVIF6.js': [Object], 'q-CWC24MGm.js': [Object], 'q-Da8PlD4L.js': [Object], 'q-DRCicbqM.js': [Object] }, injections: [], version: '1', options: { target: 'client', buildMode: 'production', entryStrategy: [Object] }, platform: { qwik: '1.13.0-dev+97aa67d', vite: '', rollup: '4.40.1', env: 'node', os: 'linux', node: '22.14.0' } } } prerendering static routes 10:05:52 ✓ Completed in 13ms. 10:05:52 [build] Rearranging server assets... 10:05:52 [build] Server built in 1.47s 10:05:52 [build] Complete! 10:05:53 [@astrojs/node] Enabling sessions with filesystem storage globalThis <ref *1> Object [global] { global: [Circular *1], clearImmediate: [Function: clearImmediate], setImmediate: [Function: setImmediate] { [Symbol(nodejs.util.promisify.custom)]: [Getter] }, clearInterval: [Function: clearInterval], clearTimeout: [Function: clearTimeout], setInterval: [Function: setInterval], setTimeout: [Function: setTimeout] { [Symbol(nodejs.util.promisify.custom)]: [Getter] }, queueMicrotask: [Function: queueMicrotask], structuredClone: [Function: structuredClone], atob: [Function: atob], btoa: [Function: btoa], performance: [Getter/Setter], fetch: [Function: fetch], navigator: [Getter], crypto: [Getter], Prism: { manual: undefined, disableWorkerMessageHandler: undefined, util: { encode: [Function: encode], type: [Function: type], objId: [Function: objId], clone: [Function: deepClone], getLanguage: [Function: getLanguage], setLanguage: [Function: setLanguage], currentScript: [Function: currentScript], isActive: [Function: isActive] }, languages: { plain: {}, plaintext: {}, text: {}, txt: {}, extend: [Function: extend], insertBefore: [Function: insertBefore], DFS: [Function: DFS], markup: [Object], html: [Object], mathml: [Object], svg: [Object], xml: [Object], ssml: [Object], atom: [Object], rss: [Object], css: [Object], clike: [Object], javascript: [Object], js: [Object] }, plugins: {}, highlightAll: [Function: highlightAll], highlightAllUnder: [Function: highlightAllUnder], highlightElement: [Function: highlightElement], highlight: [Function: highlight], tokenize: [Function: tokenize], hooks: { all: [Object], add: [Function: add], run: [Function: run] }, Token: [Function: Token] { stringify: [Function: stringify] } }, _astroGlobalDebug: [Function: debug], __extends: [Function: __extends], __assign: [Function: assign], __rest: [Function: __rest], __decorate: [Function: __decorate], __param: [Function: __param], __esDecorate: [Function: __esDecorate], __runInitializers: [Function: __runInitializers], __propKey: [Function: __propKey], __setFunctionName: [Function: __setFunctionName], __metadata: [Function: __metadata], __awaiter: [Function: __awaiter], __generator: [Function: __generator], __exportStar: [Function: __exportStar], __createBinding: [Function (anonymous)], __values: [Function: __values], __read: [Function: __read], __spread: [Function: __spread], __spreadArrays: [Function: __spreadArrays], __spreadArray: [Function: __spreadArray], __await: [Function: __await], __asyncGenerator: [Function: __asyncGenerator], __asyncDelegator: [Function: __asyncDelegator], __asyncValues: [Function: __asyncValues], __makeTemplateObject: [Function: __makeTemplateObject], __importStar: [Function: __importStar], __importDefault: [Function: __importDefault], __classPrivateFieldGet: [Function: __classPrivateFieldGet], __classPrivateFieldSet: [Function: __classPrivateFieldSet], __classPrivateFieldIn: [Function: __classPrivateFieldIn], __addDisposableResource: [Function: __addDisposableResource], __disposeResources: [Function: __disposeResources], __rewriteRelativeImportExtension: [Function: __rewriteRelativeImportExtension] } 10:05:53 [@astrojs/node] Server listening on http://localhost:4321 ``` ### Reproduction https://github.com/Shane-Donlon/testing-server-actions-reproduce ### Steps to reproduce Deploy the site to Netlify see the logs. You can also change the adapter to Node and run `npm run preview` but due to the isDev ternary statement and adapters not supporting previews this is only an issue in production. ### System Info ```shell System: OS: Linux 6.8 Linux Mint 22.1 (Xia) CPU: (16) x64 AMD Ryzen 9 6900HX with Radeon Graphics Memory: 19.91 GB / 28.13 GB Container: Yes Shell: 5.2.21 - /bin/bash Binaries: Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node npm: 11.1.0 - ~/.nvm/versions/node/v22.14.0/bin/npm pnpm: 10.4.1 - ~/.local/share/pnpm/pnpm Browsers: Brave Browser: 135.1.77.101 Chrome: 136.0.7103.59 ``` ### Additional Information _No response_
关闭于 2025-05-22 3 条评论