You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.25.1
Plugin version
8.2.0
Node.js version
16.20.2
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
FreeBSD 13.2
Description
Hello! For some reason on my server, whenever I make a change and restart it, it won't update the page I edited. It only works if I make an entirely new route to that page.
Steps to Reproduce
I am hosting this on a serv00 server, and this is my app.js file:
// Importsconstpino=require('pino');constpretty=require('pino-pretty');constlogger=pino(pretty());constfastify=require("fastify")({logger: logger});constfastifyIO=require("fastify-socket.io");constcors=require("@fastify/cors");conststriptags=require("striptags");constejs=require('ejs');constfs=require('fs');constpath=require('path');constfmsql=require('fastify-at-mysql');constmarkdown=require("markdown-it")({html: true,linkify: true,typographer: true,breaks: true,}).use(require("markdown-it-emoji")).use(require("markdown-it-abbr")).use(require("markdown-it-deflist")).use(require("markdown-it-footnote")).use(require("markdown-it-ins")).use(require("markdown-it-sub")).use(require("markdown-it-sup")).use(require("markdown-it-mark")).use(require("markdown-it-anchor")).use(require('markdown-it-link-attributes'),{attrs: {target: '_blank',}}).use(require("markdown-it-task-lists"));// Declarations/* none needed */// FunctionsfunctioncleanseMessage(message){returnstriptags(markdown.render(striptags(message)),['strong','i','em','code','a','div','sub','sup','s','abbr','dl','hr','ins','section','ol','li','sup','sub','code','pre','br','h1','h2','h3','h4','h5','h6','ul','input'])}functioncreateMessage(username,message,bio){letcleansedMessage=cleanseMessage(message);letformattedUsername=`<span class='pfplink' onclick='window.location = "/profile?user=${username}&bio=${bio}"'>${username}</span>`;letformattedDate=`<span style='font-size: small;'> [at <span id='date'></span>]</span>`;letformattedMessage=`<div id='message'><pre>${cleansedMessage}</pre></div>`;letformattedDiv=`<div style='margin: 10px 0;'><span>${formattedUsername}${formattedDate}</span>${formattedMessage}</div>`;returnformattedDiv;}// Initfastify.register(fastifyIO);fastify.register(cors);fastify.register(require('@fastify/compress'),{global: true});fastify.register(require("@fastify/view"),{engine: {ejs: require("ejs"),},});fastify.register(require('@fastify/static'),{root: path.join(__dirname,'public'),});fastify.register(fmsql,{host: process.env.DB_HOST,user: process.env.DB_USER,password: process.env.DB_PASS,database: process.env.DB_NAME,})fastify.register(function(instance,options,done){instance.setNotFoundHandler(function(req,res){code=404msg="Can't find that webpage."res.view("/views/error.ejs")})done()},{prefix: '/'})fastify.setErrorHandler(function(err,req,res){request.log.warn(err)varstatusCode=err.statusCode>=400 ? err.statusCode : 500res.code(statusCode).type('text/html').send(ejs.render(fs.readFileSync('./views/error.ejs','utf8'),{code: statusCode,msg: err.message}))})// Routes fastify.get("/",function(req,res){res.view("/views/main.ejs");});fastify.get("/chat",function(req,res){res.view("/views/chat.ejs");});fastify.get("/profile",function(req,res){user=req.query.userbio=req.query.biores.view("/views/profile.ejs");});fastify.get("/edit",function(req,res){res.view("/views/editinfo.ejs");});fastify.get("/about",function(req,res){res.view("/views/about.ejs");});fastify.get("/rules",function(req,res){res.view("/views/rules.ejs");});fastify.ready().then(()=>{fastify.io.on('connection',(client)=>{logger.info('Client connected...')client.join('::GENERAL')client.on('join',function(data){if(data.user.disName!==undefined){if(data.preroom!==''){client.leave(data.preroom);client.join(data.room);client.to(data.room).emit('broad',`<div class='statusmsg'>${data.user.disName}@${data.user.ugn} joined this chat room.</div>`);client.to(data.preroom).emit('broad',`<div class='statusmsg'>${data.user.disName}@${data.user.ugn} left this chat room.</div>`);client.emit('broad',`<div class='statusmsg'>You joined ${data.room}.</div>`);}else{logger.info(`${data.user.disName}@${data.user.ugn} joined.`);client.to('::GENERAL').emit('broad',`<div class='statusmsg'>${data.user.disName}@${data.user.ugn} joined this chat room.</div>`);client.emit('broad',"<div class='statusmsg'>You joined the chat room.</div>");}}});client.on('connect_error',(err)=>{logger.error(`connect_error due to ${err.message}`)})client.on('messages',(data)=>{if(data.user.disName!==undefined){constmessage=createMessage(`${data.user.disName}@${data.user.ugn}`,data.message,data.user.bio);client.emit('broad',message);client.to(data.room).emit('notification',data);client.to(data.room).emit('broad',message);}});})});fastify.listen({path: 'passenger',host: '127.0.0.1'});
Expected Behavior
The pages should update, but they don't unless I make another route entirely.
The text was updated successfully, but these errors were encountered:
Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.
Prerequisites
Fastify version
4.25.1
Plugin version
8.2.0
Node.js version
16.20.2
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
FreeBSD 13.2
Description
Hello! For some reason on my server, whenever I make a change and restart it, it won't update the page I edited. It only works if I make an entirely new route to that page.
Steps to Reproduce
I am hosting this on a serv00 server, and this is my app.js file:
Expected Behavior
The pages should update, but they don't unless I make another route entirely.
The text was updated successfully, but these errors were encountered: