Skip to content

Commit

Permalink
feat: vercel error message
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed Mar 16, 2024
1 parent 261f4ac commit a8d58a6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/dev/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { vValidator as validator } from '@hono/valibot-validator'
import { bytesToHex } from '@noble/curves/abstract/utils'
import { ed25519 } from '@noble/curves/ed25519'
import { Hono } from 'hono'
import { HTTPException } from 'hono/http-exception'
import type { InferResponseType, hc } from 'hono/client'
import {
deleteCookie,
Expand Down Expand Up @@ -278,6 +279,14 @@ export async function getInitialData(frameUrl: string) {

const cloned = response.clone()
const text = await response.text()

// Vercel requires authentication by default for preview deployments
if (text.includes('Authentication Required') && text.includes('vercel'))
throw new HTTPException(401, {
message:
'Vercel Authentication blocked Frog Devtools\nLearn more: https://vercel.com/docs/security/deployment-protection',
})

const metadata = htmlToMetadata(text)
const { context, frame } = metadata

Expand Down

0 comments on commit a8d58a6

Please sign in to comment.