diff --git a/apps/builder/.eslintignore b/apps/builder/.eslintignore new file mode 100644 index 000000000..4b831b415 --- /dev/null +++ b/apps/builder/.eslintignore @@ -0,0 +1 @@ +next.config.js \ No newline at end of file diff --git a/apps/builder/next.config.js b/apps/builder/next.config.js index bec526457..dd0c54844 100644 --- a/apps/builder/next.config.js +++ b/apps/builder/next.config.js @@ -14,6 +14,15 @@ const nextConfig = withTM({ experimental: { outputFileTracingRoot: path.join(__dirname, '../../'), }, + async redirects() { + return [ + { + source: '/typebots/:typebotId', + destination: '/typebots/:typebotId/edit', + permanent: true, + }, + ] + }, headers: async () => { return [ { @@ -40,6 +49,7 @@ module.exports = process.env.NEXT_PUBLIC_SENTRY_DSN ...nextConfig, sentry: { hideSourceMaps: true, + widenClientFileUpload: true, }, }, sentryWebpackPluginOptions diff --git a/apps/builder/src/lib/trpc.ts b/apps/builder/src/lib/trpc.ts index b03460ff7..11faf5755 100644 --- a/apps/builder/src/lib/trpc.ts +++ b/apps/builder/src/lib/trpc.ts @@ -1,4 +1,4 @@ -import { httpBatchLink } from '@trpc/client' +import { httpBatchLink, loggerLink } from '@trpc/client' import { createTRPCNext } from '@trpc/next' import type { AppRouter } from '../utils/server/routers/v1/trpcRouter' import superjson from 'superjson' @@ -10,6 +10,11 @@ export const trpc = createTRPCNext({ config() { return { links: [ + loggerLink({ + enabled: (opts) => + process.env.NODE_ENV === 'development' || + (opts.direction === 'down' && opts.result instanceof Error), + }), httpBatchLink({ url: `${getBaseUrl()}/api/trpc`, }), @@ -17,5 +22,5 @@ export const trpc = createTRPCNext({ transformer: superjson, } }, - ssr: true, + ssr: false, }) diff --git a/apps/builder/src/pages/_app.tsx b/apps/builder/src/pages/_app.tsx index 80e7764bb..a6f6e66bc 100644 --- a/apps/builder/src/pages/_app.tsx +++ b/apps/builder/src/pages/_app.tsx @@ -47,6 +47,7 @@ const App = ({ }, [isReady]) const typebotId = query.typebotId?.toString() + return ( <> diff --git a/apps/builder/src/pages/_error.tsx b/apps/builder/src/pages/_error.tsx index 1ae22f5bf..55d49ecf6 100644 --- a/apps/builder/src/pages/_error.tsx +++ b/apps/builder/src/pages/_error.tsx @@ -1,9 +1,6 @@ /** * NOTE: This requires `@sentry/nextjs` version 7.3.0 or higher. * - * NOTE: If using this with `next` version 12.2.0 or lower, uncomment the - * penultimate line in `CustomErrorComponent`. - * * This page is loaded by Nextjs: * - on the server, when data-fetching methods throw or reject * - on the client, when `getInitialProps` throws or rejects @@ -17,14 +14,11 @@ */ import * as Sentry from '@sentry/nextjs' -import { NextPageContext } from 'next' +import type { NextPage } from 'next' +import type { ErrorProps } from 'next/error' import NextErrorComponent from 'next/error' -const CustomErrorComponent = (props: { - statusCode: number - hasGetInitialPropsRun: boolean - err: Error -}) => { +const CustomErrorComponent: NextPage = (props) => { // If you're using a Nextjs version prior to 12.2.1, uncomment this to // compensate for https://github.com/vercel/next.js/issues/8592 // Sentry.captureUnderscoreErrorException(props); @@ -32,7 +26,7 @@ const CustomErrorComponent = (props: { return } -CustomErrorComponent.getInitialProps = async (contextData: NextPageContext) => { +CustomErrorComponent.getInitialProps = async (contextData) => { // In case this is running in a serverless function, await this in order to give Sentry // time to send the error before the lambda exits await Sentry.captureUnderscoreErrorException(contextData) diff --git a/apps/viewer/.eslintignore b/apps/viewer/.eslintignore new file mode 100644 index 000000000..4b831b415 --- /dev/null +++ b/apps/viewer/.eslintignore @@ -0,0 +1 @@ +next.config.js \ No newline at end of file diff --git a/apps/viewer/next.config.js b/apps/viewer/next.config.js index 416026460..38c0b5a7b 100644 --- a/apps/viewer/next.config.js +++ b/apps/viewer/next.config.js @@ -27,6 +27,7 @@ module.exports = process.env.NEXT_PUBLIC_SENTRY_DSN ...nextConfig, sentry: { hideSourceMaps: true, + widenClientFileUpload: true, }, }, sentryWebpackPluginOptions diff --git a/apps/viewer/src/pages/_error.tsx b/apps/viewer/src/pages/_error.tsx index d31ef5d25..55d49ecf6 100644 --- a/apps/viewer/src/pages/_error.tsx +++ b/apps/viewer/src/pages/_error.tsx @@ -1,9 +1,6 @@ /** * NOTE: This requires `@sentry/nextjs` version 7.3.0 or higher. * - * NOTE: If using this with `next` version 12.2.0 or lower, uncomment the - * penultimate line in `CustomErrorComponent`. - * * This page is loaded by Nextjs: * - on the server, when data-fetching methods throw or reject * - on the client, when `getInitialProps` throws or rejects @@ -17,13 +14,11 @@ */ import * as Sentry from '@sentry/nextjs' +import type { NextPage } from 'next' +import type { ErrorProps } from 'next/error' import NextErrorComponent from 'next/error' -const CustomErrorComponent = (props: { - statusCode: number - hasGetInitialPropsRun: boolean - err: Error -}) => { +const CustomErrorComponent: NextPage = (props) => { // If you're using a Nextjs version prior to 12.2.1, uncomment this to // compensate for https://github.com/vercel/next.js/issues/8592 // Sentry.captureUnderscoreErrorException(props); @@ -31,7 +26,7 @@ const CustomErrorComponent = (props: { return } -CustomErrorComponent.getInitialProps = async (contextData: any) => { +CustomErrorComponent.getInitialProps = async (contextData) => { // In case this is running in a serverless function, await this in order to give Sentry // time to send the error before the lambda exits await Sentry.captureUnderscoreErrorException(contextData)