Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled Runtime Error Error: schema is required to be passed as a property to TinaProvider. You can learn more about this change here: https://github.com/tinacms/tinacms/pull/2823 #259

Open
adamxrodriguez opened this issue Nov 10, 2023 · 8 comments

Comments

@adamxrodriguez
Copy link

Unhandled Runtime Error
Error: schema is required to be passed as a property to TinaProvider. You can learn more about this change here: tinacms/tinacms#2823

Tried to import and find schema. no luck. not sure how the pull/2823 applies to it. there is a but no in _app.tsx

@0xrotense
Copy link

same error here

@0xrotense
Copy link

@adamxrodriguez , Are you able to get a solution to this ?

@mirusky
Copy link

mirusky commented Dec 28, 2023

A workaround is cleanup cookies, localstorage, etc...

Still not able to navigate to /admin but at least you can continue navigating to the site and developing

@bunnypp
Copy link

bunnypp commented Jan 14, 2024

I was able to fix this somewhat following the instructions from here: https://tina.io/blog/upgrading-to-iframe/

  1. rename schema.ts to config.ts and replace defineSchema with defineConfig
  2. remove wrappers from pages/_app.tsx
  3. Delete pages/admin folder
  4. Access admin page at /admin/index.html

To fix the getPostsList bug, copy the [slug].tsx file from @logan-anderson's tina-fix repo.

@mirusky
Copy link

mirusky commented Jan 15, 2024

I'll try it later

@Ostefanini
Copy link

Ostefanini commented Feb 10, 2024

I was able to fix this somewhat following the instructions from here: https://tina.io/blog/upgrading-to-iframe/

1. rename schema.ts to config.ts and replace defineSchema with defineConfig

2. remove  wrappers from pages/_app.tsx

3. Delete pages/admin folder

4. Access admin page at /admin/index.html

To fix the getPostsList bug, copy the [slug].tsx file from @logan-anderson's tina-fix repo.

I'm trying to make it works with your instructions but no results.

For now, /admin/index.html doesn't crash anymore but it gives 404.

Here is my _app.tsx

import 'swiper/css';
import 'swiper/css/bundle';
import 'swiper/css/navigation';
import 'swiper/css/autoplay';

import { AppProps } from 'next/dist/shared/lib/router/router';
import dynamic from 'next/dynamic';
import Head from 'next/head';
import { ColorModeScript } from 'nextjs-color-mode';
import React, { PropsWithChildren } from 'react';
import { TinaEditProvider } from 'tinacms/dist/react';

import Footer from 'components/Footer';
import { GlobalStyle } from 'components/GlobalStyles';
import Navbar from 'components/Navbar';
import NavigationDrawer from 'components/NavigationDrawer';
import NewsletterModal from 'components/NewsletterModal';
import WaveCta from 'components/WaveCta';
import { NewsletterModalContextProvider, useNewsletterModalContext } from 'contexts/newsletter-modal.context';
import { NavItems } from 'types';

const navItems: NavItems = [
  { title: 'Awesome SaaS Features', href: '/features' },
  { title: 'Pricing', href: '/pricing' },
  { title: 'Contact', href: '/contact' },
  { title: 'Sign up', href: '/sign-up', outlined: true },
];

const TinaCMS = dynamic(() => import('tinacms'), { ssr: false });

function MyApp({ Component, pageProps }: AppProps) {
  return (
    <>
      <Head>
        <link rel="preconnect" href="https://fonts.googleapis.com" />
        <link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
        <link rel="icon" type="image/png" href="/favicon.png" />
        {/* <link rel="alternate" type="application/rss+xml" href={EnvVars.URL + 'rss'} title="RSS 2.0" /> */}
        {/* <script
          dangerouslySetInnerHTML={{
            __html: `window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
          ga('create', 'UA-117119829-1', 'auto');
          ga('send', 'pageview');`,
          }}
        /> */}
        {/* <script async src="https://www.google-analytics.com/analytics.js"></script> */}
      </Head>
      <ColorModeScript />
      <GlobalStyle />

      <Providers>
        <Modals />
        <Navbar items={navItems} />
{/*         <TinaEditProvider
          editMode={
            <TinaCMS
              query={pageProps.query}
              variables={pageProps.variables}
              data={pageProps.data}
              isLocalClient={!process.env.NEXT_PUBLIC_TINA_CLIENT_ID}
              branch={process.env.NEXT_PUBLIC_EDIT_BRANCH}
              clientId={process.env.NEXT_PUBLIC_TINA_CLIENT_ID}
              {...pageProps}
            >
              {(livePageProps: any) => <Component {...livePageProps} />}
            </TinaCMS>
          }
        > */}
          <Component {...pageProps} />
{/*         </TinaEditProvider>
 */}        <WaveCta />
        <Footer />
      </Providers>
    </>
  );
}

function Providers<T>({ children }: PropsWithChildren<T>) {
  return (
    <NewsletterModalContextProvider>
      <NavigationDrawer items={navItems}>{children}</NavigationDrawer>
    </NewsletterModalContextProvider>
  );
}

function Modals() {
  const { isModalOpened, setIsModalOpened } = useNewsletterModalContext();
  if (!isModalOpened) {
    return null;
  }
  return <NewsletterModal onClose={() => setIsModalOpened(false)} />;
}

export default MyApp;

@bunnypp
Copy link

bunnypp commented Feb 13, 2024

Hi @Ostefanini,

Could you show me your [slug].tsx under pages/blog/?

@sinhpn92
Copy link

sinhpn92 commented Jun 16, 2024

I was able to fix this somewhat following the instructions from here: https://tina.io/blog/upgrading-to-iframe/

  1. rename schema.ts to config.ts and replace defineSchema with defineConfig
  2. remove wrappers from pages/_app.tsx
  3. Delete pages/admin folder
  4. Access admin page at /admin/index.html

To fix the getPostsList bug, copy the [slug].tsx file from @logan-anderson's tina-fix repo.

I have the same issue. I tried the tina-fix repo, but it's still not working with this issue. Did you resolve issue? @Ostefanini

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants