Giter VIP home page Giter VIP logo

Comments (8)

samuelli avatar samuelli commented on August 12, 2024

cc @aomarks

Thanks for the report. Does it take a while to render the page? It may be hitting a timeout, or there could be a different bug with the middleware.

Do you have anything that could help us reproduce this? eg. a polymer 2 app that you reproduce this with?

from rendertron.

hekod777 avatar hekod777 commented on August 12, 2024

this error pops up as soon as the bot request is made. it probably has nothing to do with the 10 sec rendering time.

the code below is in server.js


const express = require ('express');
const app = express();
const bodyParser = require ('body-parser');
const path = require('path');
const rendertron = require('rendertron-middleware');

let port = process.env.PORT || 1337;

app.use(bodyParser.urlencoded({extended: true}));

app.use('/bower_components', express.static(path.join(__dirname, 'bower_components')));

app.use('/src', express.static(path.join(__dirname, 'src')));

app.use(rendertron.makeMiddleware({
  proxyUrl: 'localhost:3000/render',
  injectShadyDom: true,
}));

app.use(express.static('files'));

app.get('/', function(req,res){
  res.sendFile(path.resolve(__dirname, 'index.html'));
});

app.listen(port, function(){
  console.log('listening to ' + port);
});

and the index.html and the file structure is the same as
polymer init
then select polymer 2 application


I also tested it by deploying the app on heroku and using https://render-tron.appspot.com/render/ as end point.

when a bot request is made, it has this <my-app></my-app> in the body tag
but there is simply nothing inside my-app tag, not even a shadown dom.

but https://render-tron.appspot.com/render/ can actually render my heroku page correctly.

I also checked heroku logs. and it didn't show any error. when i search the logs it couldn't find any result for 'render' as well.

from rendertron.

samuelli avatar samuelli commented on August 12, 2024

@hekod777: it looks like http:// is missing from proxyUrl in that code sample. Can you try it with the full URL?

from rendertron.

hekod777 avatar hekod777 commented on August 12, 2024

@samuelli

Thank you for the advise. now the error is gone. and after adding some console.logs in rendertron. I can see that if a bot sends a request to my app. it will hit the rendertron/render end point.

and rendertron actually successfully rendered the page with a status code of either 200 or 304.

but whats inside <my-app></my-app> is still empty.

it seems that there are some problems with serving the rendered html to the bot?

also when I try to deploy my app, and use https://render-tron.appspot.com/render as end point, I got the same result (nothing inside my-app tag) when I tried to visit my app on heroku using a bing bot.

this is what i see in the heroku log

2017-08-29T20:08:33.720361+00:00 app[web.1]: https://render-tron.appspot.com/render/http%3A%2F%2Fboiling-tor-88178.herokuapp.com%2F?wc-inject-shadydom

from rendertron.

hekod777 avatar hekod777 commented on August 12, 2024

interesting

after adding '=true' in the rendertron-middleware and make the code

  if (injectShadyDom) {
      renderUrl += '?wc-inject-shadydom=true';
    }

everything worked!

from rendertron.

frankiefu avatar frankiefu commented on August 12, 2024

I saw the same problem too. Here is the PR: #82

from rendertron.

samuelli avatar samuelli commented on August 12, 2024

Thanks @hekod777, @frankiefu, let me know if there's further issues.

from rendertron.

samuelli avatar samuelli commented on August 12, 2024

The fix will be released in middleware 0.1.2. #83

from rendertron.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.