lasso-js / lasso

Advanced JavaScript module bundler, asset pipeline and optimizer
582 stars 75 forks source link

[bug] Render async fragment error (lasso-slot:body). #256

Open SandeepVattapparambil opened 6 years ago

SandeepVattapparambil commented 6 years ago

Exception has occurred: Error Error: Render async fragment error (lasso-slot:body). Exception: Error: Async fragment (lasso-slot:body) timed out after 30000ms at Timeout._onTimeout (/Users/sandeep/Desktop/web.sdk/sdk-revamp/node_modules/marko/src/runtime/html/AsyncStream.js:193:32) at ontimeout (timers.js:386:14) at tryOnTimeout (timers.js:250:5) at Timer.listOnTimeout (timers.js:214:5) Creation stack trace: Error at AsyncStream.beginAsync (/Users/sandeep/Desktop/web.sdk/sdk-revamp/node_modules/marko/src/runtime/html/AsyncStream.js:188:55) at render (/Users/sandeep/Desktop/web.sdk/sdk-revamp/node_modules/lasso/taglib/slot-tag.js:94:28) at render (/Users/sandeep/Desktop/web.sdk/sdk-revamp/node_modules/lasso/taglib/body-tag.js:10:5) at wrappedRenderer (/Users/sandeep/Desktop/web.sdk/sdk-revamp/node_modules/marko/src/runtime/helpers.js:106:13) at render (/Users/sandeep/Desktop/web.sdk/sdk-revamp/src/components/app-main/index.marko.js:46:3) at renderer (/Users/sandeep/Desktop/web.sdk/sdk-revamp/node_modules/marko/src/components/renderer.js:186:9) at wrappedRenderer (/Users/sandeep/Desktop/web.sdk/sdk-revamp/node_modules/marko/src/runtime/helpers.js:106:13) at render (/Users/sandeep/Desktop/web.sdk/sdk-revamp/src/templates/product/index.marko.js:29:3) at renderer (/Users/sandeep/Desktop/web.sdk/sdk-revamp/node_modules/marko/src/components/renderer.js:186:9) at safeRender (/Users/sandeep/Desktop/web.sdk/sdk-revamp/node_modules/marko/src/runtime/renderable.js:6:9) at AsyncStream.error (/Users/sandeep/Desktop/web.sdk/sdk-revamp/node_modules/marko/src/runtime/html/AsyncStream.js:429:13) at Timeout._onTimeout (/Users/sandeep/Desktop/web.sdk/sdk-revamp/node_modules/marko/src/runtime/html/AsyncStream.js:193:26) at ontimeout (timers.js:386:14) at tryOnTimeout (timers.js:250:5) at Timer.listOnTimeout (timers.js:214:5)

austinkelleher commented 6 years ago

Hey, @SandeepVattapparambil. I'm going to need a bit more information in order to help you. What version of Lasso are you using? Are you using marko-starter? Is this happening when you run a build? If it's coming from a component, perhaps you could isolate the issue and post a code sample. Thanks.

SandeepVattapparambil commented 6 years ago

I am using marko "^4.7.0" and lasso "^2.11.21". This happens when the build happens and when i hit a route. and this is from a component

SandeepVattapparambil commented 6 years ago

This problem persists on lasso version above ^2.11.21 and not on 2.11.21 and below "lasso": "2.11.21" is not making any problem

austinkelleher commented 6 years ago

@SandeepVattapparambil Can you try upgrading to the latest marko and latest lasso-marko?

maxmilton commented 6 years ago

I'm also running into this issue. Using marko-starter. Still an issue with all packages at the latest version.

Occurs when using any lasso plugins, e.g. project.js:

module.exports = require('marko-starter').projectConfig({
  lassoConfig: {
    plugins: [
      'lasso-marko',
      'lasso-stylus',
    ],
  },
});

The relevant part of my package.json

  "dependencies": {
    "marko": "^4.7.4",
  },
  "devDependencies": {
    "lasso-marko": "^2.4.0",
    "lasso-postcss": "^0.1.1",
    "marko-starter": "^2.0.2",
  },
Here's my actual project.js ```javascript const isProduction = process.env.NODE_ENV === 'production'; module.exports = require('marko-starter').projectConfig({ name: 'pro-auth', lassoConfig: { bundlingEnabled: isProduction, fingerprintsEnabled: isProduction, minifyJS: isProduction, minifyCSS: isProduction, plugins: [ 'lasso-marko', { plugin: 'lasso-postcss', config: { // plugins: [], // options: {}, // extensions: [], sourceMaps: true, }, }, ], }, }); ```
Full error stacktrace ``` yarn run v1.3.2 $ NODE_ENV=development marko-starter server [browser-refresh] Watching: /home/max/Development/prowearegenkicom/auth [browser-refresh] Ignore rule: node_modules/ [browser-refresh] Ignore rule: static/ [browser-refresh] Ignore rule: .cache/ [browser-refresh] Ignore rule: .* [browser-refresh] Ignore rule: *.marko.js [browser-refresh] Ignore rule: *.dust.js [browser-refresh] Ignore rule: *.coffee.js [browser-refresh] App started (pid: 32388) [marko-starter plugins] Installed plugin: lasso [marko-starter plugins] Installed plugin: generic-http-server [marko-starter pro-auth] Starting server... [marko-starter pro-auth] CONFIGURATION: name: pro-auth routePathPrefix: / version: 0.0.0 dir: /home/max/Development/prowearegenkicom/auth buildNumber: 0 colors: true minify: (not set) minifyCss: (not set) minifyJs: (not set) fingerPrintsEnabled: (not set) production: false flags: (not set) outputDir: /home/max/Development/prowearegenkicom/auth/.cache/static staticUrlPrefix: /static/ plugins: (not set) lassoConfig: { "bundlingEnabled": false, "fingerprintsEnabled": false, "minifyJS": false, "minifyCSS": false, "plugins": [ "lasso-marko", { "plugin": "lasso-postcss", "config": { "sourceMaps": true } } ] } httpPort: 8079 sslCert: (not set) sslKey: (not set) [marko-starter pro-auth lasso] Configured default lasso [marko-starter pro-auth http-server] [route] OPTIONS /static/** [marko-starter pro-auth http-server] [route] GET /static/** [marko-starter pro-auth http-server] [route] GET / [marko-starter pro-auth http-server] [route] GET /login [marko-starter pro-auth http-server] [route] GET /reset-password [marko-starter pro-auth http-server] [route] GET /signup [marko-starter pro-auth http-server] LISTENING ON: http://localhost:8079 [browser-refresh] Server is ready. Watching files for changes. [marko-starter pro-auth http-server request] GET / [marko-starter pro-auth] Building page /... Render async fragment error (lasso-slot:head). Exception: Error: Failed to walk dependency [marko-hydrate: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Dependency chain: [marko-hydrate: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Cause: Error: Failed to walk dependency [marko-dependencies: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Dependency chain: [marko-hydrate: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"] → [marko-dependencies: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Cause: AssertionError [ERR_ASSERTION]: "targetModule" should be a string at module.exports (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/node_modules/raptor-util/createError.js:7:50) at walkDependency (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependency-walker.js:123:23) at at process._tickCallback (internal/process/next_tick.js:160:7) Caused by: Error: Failed to walk dependency [marko-dependencies: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Dependency chain: [marko-hydrate: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"] → [marko-dependencies: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Cause: AssertionError [ERR_ASSERTION]: "targetModule" should be a string at module.exports (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/node_modules/raptor-util/createError.js:7:50) at walkDependency (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependency-walker.js:123:23) at at process._tickCallback (internal/process/next_tick.js:160:7) Caused by: AssertionError [ERR_ASSERTION]: "targetModule" should be a string at Object.resolve (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/resolve/index.js:29:9) at LassoContext.resolve (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/LassoContext.js:97:35) at Ctor.resolvePath (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependencies/Dependency.js:199:36) at dependencies.concat.meta.deps.map.depPath (/home/max/Development/prowearegenkicom/auth/node_modules/lasso-marko/lasso-marko-plugin.js:100:52) at Array.map () at Ctor.getDependencies (/home/max/Development/prowearegenkicom/auth/node_modules/lasso-marko/lasso-marko-plugin.js:98:66) at Ctor.getPackageManifest (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependencies/Dependency.js:288:43) at walkDependency (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependency-walker.js:109:61) at at process._tickCallback (internal/process/next_tick.js:160:7) Creation stack trace: Error at AsyncStream.beginAsync (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/runtime/html/AsyncStream.js:188:55) at render (/home/max/Development/prowearegenkicom/auth/node_modules/@lasso/marko-taglib/taglib/slot-tag.js:97:24) at render (/home/max/Development/prowearegenkicom/auth/node_modules/@lasso/marko-taglib/taglib/head-tag.js:16:3) at wrappedRenderer (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/runtime/helpers.js:106:13) at render (/home/max/Development/prowearegenkicom/auth/src/components/site-layout/index.marko.js:34:3) at Template.renderer (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/components/renderer.js:186:9) at hotReloadProxy (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/hot-reload.js:85:31) at wrappedRenderer (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/runtime/helpers.js:106:13) at render (/home/max/Development/prowearegenkicom/auth/src/index.marko.js:19:3) at Template.renderer (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/components/renderer.js:186:9) Render async fragment error (lasso-slot:body). Exception: Error: Failed to walk dependency [marko-hydrate: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Dependency chain: [marko-hydrate: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Cause: Error: Failed to walk dependency [marko-dependencies: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Dependency chain: [marko-hydrate: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"] → [marko-dependencies: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Cause: AssertionError [ERR_ASSERTION]: "targetModule" should be a string at module.exports (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/node_modules/raptor-util/createError.js:7:50) at walkDependency (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependency-walker.js:123:23) at at process._tickCallback (internal/process/next_tick.js:160:7) Caused by: Error: Failed to walk dependency [marko-dependencies: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Dependency chain: [marko-hydrate: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"] → [marko-dependencies: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Cause: AssertionError [ERR_ASSERTION]: "targetModule" should be a string at module.exports (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/node_modules/raptor-util/createError.js:7:50) at walkDependency (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependency-walker.js:123:23) at at process._tickCallback (internal/process/next_tick.js:160:7) Caused by: AssertionError [ERR_ASSERTION]: "targetModule" should be a string at Object.resolve (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/resolve/index.js:29:9) at LassoContext.resolve (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/LassoContext.js:97:35) at Ctor.resolvePath (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependencies/Dependency.js:199:36) at dependencies.concat.meta.deps.map.depPath (/home/max/Development/prowearegenkicom/auth/node_modules/lasso-marko/lasso-marko-plugin.js:100:52) at Array.map () at Ctor.getDependencies (/home/max/Development/prowearegenkicom/auth/node_modules/lasso-marko/lasso-marko-plugin.js:98:66) at Ctor.getPackageManifest (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependencies/Dependency.js:288:43) at walkDependency (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependency-walker.js:109:61) at at process._tickCallback (internal/process/next_tick.js:160:7) Creation stack trace: Error at AsyncStream.beginAsync (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/runtime/html/AsyncStream.js:188:55) at render (/home/max/Development/prowearegenkicom/auth/node_modules/@lasso/marko-taglib/taglib/slot-tag.js:97:24) at render (/home/max/Development/prowearegenkicom/auth/node_modules/@lasso/marko-taglib/taglib/body-tag.js:16:3) at wrappedRenderer (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/runtime/helpers.js:106:13) at render (/home/max/Development/prowearegenkicom/auth/src/components/site-layout/index.marko.js:56:3) at Template.renderer (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/components/renderer.js:186:9) at hotReloadProxy (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/hot-reload.js:85:31) at wrappedRenderer (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/runtime/helpers.js:106:13) at render (/home/max/Development/prowearegenkicom/auth/src/index.marko.js:19:3) at Template.renderer (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/components/renderer.js:186:9) [marko-starter pro-auth] Error building page /. Error: Error: Render async fragment error (lasso-slot:head). Exception: Error: Failed to walk dependency [marko-hydrate: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Dependency chain: [marko-hydrate: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Cause: Error: Failed to walk dependency [marko-dependencies: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Dependency chain: [marko-hydrate: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"] → [marko-dependencies: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Cause: AssertionError [ERR_ASSERTION]: "targetModule" should be a string at module.exports (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/node_modules/raptor-util/createError.js:7:50) at walkDependency (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependency-walker.js:123:23) at at process._tickCallback (internal/process/next_tick.js:160:7) Caused by: Error: Failed to walk dependency [marko-dependencies: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Dependency chain: [marko-hydrate: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"] → [marko-dependencies: path="/home/max/Development/prowearegenkicom/auth/src/index.marko"]. Cause: AssertionError [ERR_ASSERTION]: "targetModule" should be a string at module.exports (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/node_modules/raptor-util/createError.js:7:50) at walkDependency (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependency-walker.js:123:23) at at process._tickCallback (internal/process/next_tick.js:160:7) Caused by: AssertionError [ERR_ASSERTION]: "targetModule" should be a string at Object.resolve (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/resolve/index.js:29:9) at LassoContext.resolve (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/LassoContext.js:97:35) at Ctor.resolvePath (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependencies/Dependency.js:199:36) at dependencies.concat.meta.deps.map.depPath (/home/max/Development/prowearegenkicom/auth/node_modules/lasso-marko/lasso-marko-plugin.js:100:52) at Array.map () at Ctor.getDependencies (/home/max/Development/prowearegenkicom/auth/node_modules/lasso-marko/lasso-marko-plugin.js:98:66) at Ctor.getPackageManifest (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependencies/Dependency.js:288:43) at walkDependency (/home/max/Development/prowearegenkicom/auth/node_modules/lasso/src/dependency-walker.js:109:61) at at process._tickCallback (internal/process/next_tick.js:160:7) Creation stack trace: Error at AsyncStream.beginAsync (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/runtime/html/AsyncStream.js:188:55) at render (/home/max/Development/prowearegenkicom/auth/node_modules/@lasso/marko-taglib/taglib/slot-tag.js:97:24) at render (/home/max/Development/prowearegenkicom/auth/node_modules/@lasso/marko-taglib/taglib/head-tag.js:16:3) at wrappedRenderer (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/runtime/helpers.js:106:13) at render (/home/max/Development/prowearegenkicom/auth/src/components/site-layout/index.marko.js:34:3) at Template.renderer (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/components/renderer.js:186:9) at hotReloadProxy (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/hot-reload.js:85:31) at wrappedRenderer (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/runtime/helpers.js:106:13) at render (/home/max/Development/prowearegenkicom/auth/src/index.marko.js:19:3) at Template.renderer (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/components/renderer.js:186:9) at AsyncStream.error (/home/max/Development/prowearegenkicom/auth/node_modules/marko/src/runtime/html/AsyncStream.js:429:13) at process.nextTick (/home/max/Development/prowearegenkicom/auth/node_modules/@lasso/marko-taglib/taglib/slot-tag.js:108:20) at process._tickCallback (internal/process/next_tick.js:150:11) ```
maxmilton commented 6 years ago

After debugging a some more, this bug only happens when a .marko file has

style {
  ...
}

Possibly also related to this, if a .marko file as a class {} then all the styles loaded and then quickly removed — a flash of styled content. In this case there are no errors or warnings reported.

maxmilton commented 6 years ago

After more playing around I've found it's only an issue in routes but not components. Perhaps I'm misunderstanding how routes work (using marko-starter) but since the file names end with .marko I assume they're just components.

Not sure if this is the correct place for my issue anymore. Please let me know if there's a more appropriate place to open an issue.

ianvonholt commented 6 years ago

@austinkelleher I'm encountering this bug as well with anything after the hydrate update in lasso@2.11.22

Working versions:

lasso@2.11.21
lasso_marko@2.4.0
marko@4.7.4

The error is quite simple, in my case:

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: Render async fragment error (lasso-slot:head). Exception: Error: Async fragment (lasso-slot:head) timed out after 30000ms
    at Timeout._onTimeout (.../node_modules/marko/dist/runtime/html/AsyncStream.js:190:33)
    at ontimeout (timers.js:475:11)
    at tryOnTimeout (timers.js:310:5)
    at Timer.listOnTimeout (timers.js:270:5)
    at AsyncStream.error (.../node_modules/marko/dist/runtime/html/AsyncStream.js:426:13)
    at Timeout.<anonymous> (.../node_modules/marko/dist/runtime/html/AsyncStream.js:190:27)
    at ontimeout (timers.js:475:11)
    at tryOnTimeout (timers.js:310:5)
    at Timer.listOnTimeout (timers.js:270:5)
App stopped unexpectedly

I'll see if I can't track down more of what is happening.

VSJ commented 6 years ago

@ianvonholt any update on this issue? I am facing the same problem.

slavik-m commented 6 years ago

+1 Guys.

ianvonholt commented 6 years ago

Sorry @VSJ, I haven't had time to investigate. Priorities at work shifted away from newer Marko and Lasso version support.

slavik-m commented 6 years ago

Try to update lasso to the new version manually. Lasso version 3.1.3 works correctly. This is a lasso-cli issue. Need to update the "lasso": "^2.11.19" dependencies on the lasso-cli package.

caracal7 commented 6 years ago

I have the same issue(

jacobgoh101 commented 5 years ago

I received this error in marko-starter.

The advice from this article works for me.

Just update

"dependencies": {
    "marko": "^4.2.4",
    "marko-starter": "^1.0.0"
},

to

"dependencies": {
    "marko": "^4.4.28",
    "marko-starter": "^2.0.1"
},

and rerun npm install.

7shabir commented 5 years ago

@jacobgoh101 Perfect! I've been looking for this solution for a long time.