Skip to content

Commit

Permalink
🔊 Add DEBUG mode with valuable logs in viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed May 16, 2023
1 parent f8ea2e1 commit 72058fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/docs/docs/self-hosting/configuration/viewer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Parameters marked with <Asterix/> are required.
| ENCRYPTION_SECRET <Asterix/> | | A 256-bit key used to encrypt sensitive data. It is strongly recommended to [generate](https://www.allkeysgenerator.com/Random/Security-Encryption-Key-Generator.aspx) a new one. The secret should be the same between builder and viewer. |
| NEXT_PUBLIC_VIEWER_URL <Asterix/> | | The viewer base URL. Should be the publicly accessible URL (i.e. `https://bot.domain.com`) |
| NEXTAUTH_URL <Asterix/> | | The builder base URL. Should be the publicly accessible URL (i.e. `https://typebot.domain.com`) |
| DEBUG | false | If enabled, the server will print valuable logs to debug config issues. |

## Emails (Notifications)

Expand Down
9 changes: 9 additions & 0 deletions apps/viewer/src/pages/[[...publicId]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ const incompatibleBrowsers = [
},
]

const log = (message: string) => {
if (process.env.DEBUG !== 'true') return
console.log(`[DEBUG] ${message}`)
}

export const getServerSideProps: GetServerSideProps = async (
context: GetServerSidePropsContext
) => {
Expand All @@ -38,9 +43,12 @@ export const getServerSideProps: GetServerSideProps = async (
)?.name ?? null
const pathname = context.resolvedUrl.split('?')[0]
const { host, forwardedHost } = getHost(context.req)
log(`host: ${host}`)
log(`forwardedHost: ${forwardedHost}`)
try {
if (!host) return { props: {} }
const viewerUrls = (getViewerUrl({ returnAll: true }) ?? '').split(',')
log(`viewerUrls: ${viewerUrls}`)
const isMatchingViewerUrl =
env('E2E_TEST') === 'true'
? true
Expand All @@ -52,6 +60,7 @@ export const getServerSideProps: GetServerSideProps = async (
.split(':')[0]
.includes(url.split('//')[1].split(':')[0]))
)
log(`isMatchingViewerUrl: ${isMatchingViewerUrl}`)
const customDomain = `${forwardedHost ?? host}${
pathname === '/' ? '' : pathname
}`
Expand Down

3 comments on commit 72058fd

@vercel
Copy link

@vercel vercel bot commented on 72058fd May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2 – ./apps/viewer

chatbot.repplai.com
demo.botscientis.us
demo.wemakebots.xyz
hrbot.robomotion.io
inearephones.cr8.ai
kbsub.wpwakanda.com
limitenahora.com.br
live.botscientis.us
mentoria.omelhor.vc
form.searchcube.com.sg
gcase.barrettamario.it
help.giversforgood.com
info.clickasuransi.com
kodawariab736.skeep.it
michaeljackson.riku.ai
premium.kandabrand.com
report.gratirabbit.com
resume.gratirabbit.com
83242573.actualizar.xyz
87656003.actualizar.xyz
88152257.actualizar.xyz
91375310.actualizar.xyz
app.youvisitedthis.site
arrivalx2.wpwakanda.com
bot.blackboxtips.com.br
bot.hotelplayarimini.it
bot.upgradesolutions.eu
bots.baptiste-arnaud.fr
help.comebackreward.com
link.venturasuceder.com
mainmenu.diddancing.com
manualhandlingcourse.ie
prebook.enthrallart.com
primitive-shapes.cr8.ai
register.kandabrand.com
sell.sellitwithgary.com
signup.hypemarketing.in
subfooter.wpwakanda.com
survey.hypemarketing.in
testbot.afterorigin.com
typebot.influencer.love
www.chatgpt-biliran.com
91181264.your-access.one
abg-assistent.m-vogel.de
ai.chromebookstoreph.com
chat.hiabhaykulkarni.com
contextone.wpwakanda.com
form.sergiolimajr.com.br
hunterbot.saleshunter.ai
invite.bridesquadapp.com
link.cascadigital.com.br
login.algorithmpress.com
onboarding.growthside.io
reward.onlinebotdemo.xyz
stap.venturemarketing.in
presente.empresarias.com.mx
register.algorithmpress.com
sell.sellthemotorhome.co.uk
anamnese.odontopavani.com.br
austin.channelautomation.com
bot.marketingplusmindset.com
bot.seidibergamoseanchetu.it
desabafe.sergiolimajr.com.br
download.venturemarketing.in
open.campus.aalen.university
piazzatorre.barrettamario.it
poll.mosaicohairboutique.com
type.cookieacademyonline.com
upload.atlasoutfittersk9.com
bot.brigadeirosemdrama.com.br
tuttirecepcao.fratucci.com.br
forms.escoladeautomacao.com.br
onboarding.libertydreamcare.ie
recepcao.tutti.fratucci.com.br
type.talitasouzamarques.com.br
agendamento.sergiolimajr.com.br
anamnese.clinicamegasjdr.com.br
bookings.littlepartymonkeys.com
bot.comercializadoraomicron.com
elevateyourmind.groovepages.com
viewer-v2-typebot-io.vercel.app
yourfeedback.comebackreward.com
baleia.testeeventos.progenbr.com
bot.cabin-rentals-of-georgia.net
open.campus.bot.aalen.university
sondaggio.mosaicohairboutique.it
baleia.testegabinete.progenbr.com
gerador.verificadordehospedes.com
personal-trainer.barrettamario.it
sondaggio.mosaicohairboutique.com
preagendamento.sergiolimajr.com.br
studiotecnicoimmobiliaremerelli.it
download.thailandmicespecialist.com
register.thailandmicespecialist.com
bot.studiotecnicoimmobiliaremerelli.it
pesquisa.escolamodacomproposito.com.br
anamnese.clinicaramosodontologia.com.br
chrome-os-inquiry-system.itschromeos.com
viewer-v2-git-main-typebot-io.vercel.app
main-menu-for-itschromeos.itschromeos.com

@vercel
Copy link

@vercel vercel bot commented on 72058fd May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 72058fd May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-git-main-typebot-io.vercel.app
docs.typebot.io
docs-typebot-io.vercel.app

Please sign in to comment.