Skip to content

Commit

Permalink
🔊 Add logs to debug invalid env
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Aug 30, 2023
1 parent 124cb8f commit 96ddfad
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
3 changes: 1 addition & 2 deletions apps/viewer/src/components/Seo.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { gtmHeadSnippet } from '@/lib/google-tag-manager'
import { Metadata } from '@typebot.io/schemas'
import Head from 'next/head'
import Script from 'next/script'
import React from 'react'
import { isNotEmpty } from '@typebot.io/lib'
import { Metadata } from '@typebot.io/schemas/features/typebot/settings'

type SEOProps = {
url: string
Expand Down
3 changes: 2 additions & 1 deletion apps/viewer/src/components/TypebotPageV3.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Standard } from '@typebot.io/nextjs'
import { BackgroundType, Typebot } from '@typebot.io/schemas'
import { useRouter } from 'next/router'
import { SEO } from './Seo'
import { Typebot } from '@typebot.io/schemas/features/typebot/typebot'
import { BackgroundType } from '@typebot.io/schemas/features/typebot/theme/enums'

export type TypebotV3PageProps = {
url: string
Expand Down
21 changes: 20 additions & 1 deletion packages/env/env.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { createEnv } from '@t3-oss/env-nextjs'
import { z } from 'zod'
import { ZodError, z } from 'zod'
import { getRuntimeVariable } from './getRuntimeVariable'

declare const window: {
__ENV?: any
}

const boolean = z.enum(['true', 'false']).transform((value) => value === 'true')

const baseEnv = {
Expand Down Expand Up @@ -313,6 +317,21 @@ export const env = createEnv({
...sentryEnv.runtimeEnv,
...posthogEnv.runtimeEnv,
},
onValidationError: (error: ZodError) => {
console.log(
'[DEBUG]',
"typeof window !== 'undefined'",
typeof window !== 'undefined'
)
if (typeof window !== 'undefined') {
console.log('[DEBUG]', 'window.__ENV', window.__ENV)
}
console.error(
'❌ Invalid environment variables:',
error.flatten().fieldErrors
)
throw new Error('Invalid environment variables')
},
onInvalidAccess: (variable: string) => {
throw new Error(
`❌ Attempted to access a server-side environment variable on the client: ${variable}`
Expand Down

3 comments on commit 96ddfad

@vercel
Copy link

@vercel vercel bot commented on 96ddfad Aug 30, 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 96ddfad Aug 30, 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:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app
app.typebot.io

@vercel
Copy link

@vercel vercel bot commented on 96ddfad Aug 30, 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

start.belenmotz.com
support.wawplus.com
survey1.digienge.io
surveys.essiell.com
test.botscientis.us
test.getreview.help
test.reventepro.com
typebot.stillio.app
typebot.stillio.com
vg.onewebcenter.com
wa.onewebcenter.com
web.draleticiah.com
whatsdigital.online
wordsandimagery.com
88584434.therpm.club
92109660.therpm.club
app.horadelucrar.com
assistent.m-vogel.de
ativandograna.online
bium.gratirabbit.com
bot.ansuraniphone.my
bot.barrettamario.it
bot.buenanoticia.fun
bot.conhecaojogo.com
bot.cotemeuplano.com
bot.gameincrivel.com
bot.gamesimples.club
bot.grupodojo.com.br
bot.jogoquelucra.com
bot.leadbooster.help
bot.mycompay.reviews
bot.socialcliques.me
cha.onewebcenter.com
chat.gnipharmahq.com
chat.hayurihijab.com
chat.jottagreens.com
chatbee.agfunnel.com
click.sevenoways.com
connect.growthguy.in
detetivepatricia.com
drapamela.gikpro.com
drgisellegarcia.site
forms.bonanza.design
hello.advergreen.com
infomakeracademy.com
kuiz.sistemniaga.com
leoborges-app.online
linspecteuremma.site
malayanboosterhq.com
menukb.wpwakanda.com
link.cascadigital.com.br
listasecreta.utuahub.com
login.algorithmpress.com
mail2wa.barrettamario.it
mdb.evento2.progenbr.com
onboarding.growthside.io
planorejuvenescedor.site
programaantizumbido.site
reducao.onewebcenter.com
reward.onlinebotdemo.xyz
sondaggio.thegymgame.com
stap.venturemarketing.in
type.boardacademy.com.br
type.opaulovieira.com.br
whatsweb.marketei.com.br
aibot.angrybranding.co.uk
alistasecreta.utuahub.com
app.photosbackupin1.click
bot.aidigitalmarketing.kr
bot.arraesecenteno.com.br
bot.blackboxsports.com.br
bot.cabinrentalagency.com
bot.draelzanakahagi.cloud
bot.fusionstarreviews.com
bot.ristorantekintsugi.it
boyfriend-breakup.riku.ai
brigadeirosemdrama.com.br
chat.ertcrebateportal.com
chat.hackercontrol.com.br
chat.sucessonarede.com.br
chat.thehomebuyersusa.com
chat.thisiscrushhouse.com
chat2.ambassadorelena.com
consulta.jornalextra.site
healthandsafetycourses.uk
mdb.imprensa.progenbr.com
programarejuvenescer.site
sellmyharleylouisiana.com
testbot.sharemyreview.net
typebot-viewer.vercel.app
verfica.botmachine.com.br
www.portaldasanalises.com
ap-help.algorithmpress.com
ap-main.algorithmpress.com
bcorporate.carlosbusch.com
bot.adventureconsulting.hu
bot.aestrategianova.online
bot.conquistadoralpha.site
bot.desafiode15dias.online
bot.descobrindotraicao.top

Please sign in to comment.