Git Product home page Git Product logo

project_nextjs13_flexibble's Introduction


Project Banner
nextdotjs cloudinary graphql jsonwebtokens typescript tailwindcss headlessui

A Full Stack Dribble Clone

Build this project step by step with our detailed tutorial on JavaScript Mastery YouTube. Join the JSM family!
  1. 🤖 Introduction
  2. ⚙️ Tech Stack
  3. 🔋 Features
  4. 🤸 Quick Start
  5. 🕸️ Snippets
  6. 🔗 Links
  7. 🚀 More

🚨 Tutorial

This repository contains the code corresponding to an in-depth tutorial available on our YouTube channel, JavaScript Mastery.

If you prefer visual learning, this is the perfect resource for you. Follow our tutorial to learn how to build projects like these step-by-step in a beginner-friendly manner!

A full stack Dribble clone developed using Next.js, GraphQL, Next Auth, TypeScript, and tailwindcss features all the necessary features of dribble from sharing and showcasing projects.

If you're getting started and need assistance or face any bugs, join our active Discord community with over 27k+ members. It's a place where people help each other out.

  • Next.js
  • Next Auth
  • TypeScript
  • JSON Web Token
  • GraphQL
  • Grafbase
  • Cloudinary
  • Tailwind CSS
  • Headless UI

👉 Modern Design Home Page: Features a clean and modern design resembling Dribbble, with a visually appealing interface showcasing project previews and navigation.

👉 Browsing and Pagination: Browse different projects, filter them by category, and experience smooth pagination for seamless data exploration.

👉 Authentication & Authorization System: A fully functional authentication and authorization system allows users to log in securely using JWT and Google authentication.

👉 Create Post Page: Provides a dedicated space for users to share their projects with the community. It includes fields for project details, images, and other relevant information.

👉 Project Details and Related Projects: A detailed view with related projects functionality, enabling users to explore more projects within the same category or theme.

👉 Edit and Re-upload Images: Users have the capability to edit previously created projects, including the ability to re-upload images from their devices to the cloud for updates.

👉 Delete Projects: The delete functionality simplifies project removal with a one-click process, streamlining the user experience.

👉 Portfolio-Style User Profile Page: The user profile page adopts a portfolio-style layout, displaying the user's projects along with the project profiles of other users for easy exploration.

👉 Backend API Routes: Backend API routes for handling JWT token management for secure authentication and image uploading, supporting seamless integration with the frontend.

and many more, including code architecture and reusability

Follow these steps to set up the project locally on your machine.

Prerequisites

Make sure you have the following installed on your machine:

Cloning the Repository

git clone https://github.com/adrianhajdin/project_nextjs13_flexibble.git
cd project_nextjs13_flexibble

Installation

Install the project dependencies using npm:

npm install

Set Up Environment Variables

Create a new file named .env in the root of your project and add the following content:

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
NEXTAUTH_URL=
NEXTAUTH_SECRET=
CLOUDINARY_NAME=
CLOUDINARY_KEY=
CLOUDINARY_SECRET=
GRAFBASE_API_URL=
GRAFBASE_API_KEY=

Replace the placeholder values with your actual credentials. You can obtain these credentials by signing up on the corresponding websites from Google Cloud, Cloudinary, and Grafbase.

For the Next Auth secret, you can generate any random secret using crytool.

Running the Project

npm run dev

Open http://localhost:3000 in your browser to view the project.

common.types.ts
import { User, Session } from 'next-auth'

export type FormState = {
    title: string;
    description: string;
    image: string;
    liveSiteUrl: string;
    githubUrl: string;
    category: string;
};

export interface ProjectInterface {
    title: string;
    description: string;
    image: string;
    liveSiteUrl: string;
    githubUrl: string;
    category: string;
    id: string;
    createdBy: {
      name: string;
      email: string;
      avatarUrl: string;
      id: string;
    };
}

export interface UserProfile {
    id: string;
    name: string;
    email: string;
    description: string | null;
    avatarUrl: string;
    githubUrl: string | null;
    linkedinUrl: string | null;
    projects: {
      edges: { node: ProjectInterface }[];
      pageInfo: {
        hasPreviousPage: boolean;
        hasNextPage: boolean;
        startCursor: string;
        endCursor: string;
      };
    };
}

export interface SessionInterface extends Session {
  user: User & {
    id: string;
    name: string;
    email: string;
    avatarUrl: string;
  };
}

export interface ProjectForm {
  title: string;
  description: string;
  image: string;
  liveSiteUrl: string;
  githubUrl: string;
  category: string;
}
constants.ts
export const NavLinks = [
  { href: '/', key: 'Inspiration', text: 'Inspiration' },
  { href: '/', key: 'Find Projects', text: 'Find Projects' },
  { href: '/', key: 'Learn Development', text: 'Learn Development' },
  { href: '/', key: 'Career Advancement', text: 'Career Advancement' },
  { href: '/', key: 'Hire Developers', text: 'Hire Developers' }
];

export const categoryFilters = [
  "Frontend",
  "Backend",
  "Full-Stack",
  "Mobile",
  "UI/UX",
  "Game Dev",
  "DevOps",
  "Data Science",
  "Machine Learning",
  "Cybersecurity",
  "Blockchain",
  "E-commerce",
  "Chatbots"
]

export const footerLinks = [
  {
    title: 'For developers',
    links: [
      'Go Pro!',
      'Explore development work',
      'Development blog',
      'Code podcast',
      'Open-source projects',
      'Refer a Friend',
      'Code of conduct',
    ],
  },
  {
    title: 'Hire developers',
    links: [
      'Post a job opening',
      'Post a freelance project',
      'Search for developers',
    ],
  },
  {
    title: 'Brands',
    links: [
      'Advertise with us',
    ],
  },
  {
    title: 'Company',
    links: [
      'About',
      'Careers',
      'Support',
      'Media kit',
      'Testimonials',
      'API',
      'Terms of service',
      'Privacy policy',
      'Cookie policy',
    ],
  },
  {
    title: 'Directories',
    links: [
      'Development jobs',
      'Developers for hire',
      'Freelance developers for hire',
      'Tags',
      'Places',
    ],
  },
  {
    title: 'Development assets',
    links: [
      'Code Marketplace',
      'GitHub Marketplace',
      'NPM Registry',
      'Packagephobia',
    ],
  },
  {
    title: 'Development Resources',
    links: [
      'Freelancing',
      'Development Hiring',
      'Development Portfolio',
      'Development Education',
      'Creative Process',
      'Development Industry Trends',
    ],
  },
];
globals.css
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

@tailwind base;
@tailwind components;
@tailwind utilities;

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Inter;
}

.flexCenter {
  @apply flex justify-center items-center;
}

.flexBetween {
  @apply flex justify-between items-center;
}

.flexStart {
  @apply flex items-center justify-start;
}

.text-small {
  @apply text-sm font-medium;
}

.paddings {
  @apply lg:px-20 py-6 px-5;
}

::-webkit-scrollbar {
  width: 5px;
  height: 4px;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 12px;
}

.modal-head-text {
  @apply md:text-5xl text-3xl font-extrabold text-left max-w-5xl w-full;
}

.no-result-text {
  @apply w-full text-center my-10 px-2;
}

/* Project Details */
.user-actions_section {
  @apply fixed max-md:hidden flex gap-4 flex-col right-10 top-20;
}

.user-info {
  @apply flex flex-wrap whitespace-nowrap text-sm font-normal gap-2 w-full;
}

/* Home */
.projects-grid {
  @apply grid xl:grid-cols-4 md:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-10 mt-10 w-full;
}

/* Project Actions */
.edit-action_btn {
  @apply p-3 text-gray-100 bg-light-white-400 rounded-lg text-sm font-medium;
}

.delete-action_btn {
  @apply p-3 text-gray-100 hover:bg-red-600 rounded-lg text-sm font-medium;
}

/* Related Project Card */
.related_project-card {
  @apply flex-col rounded-2xl min-w-[210px] min-h-[197px];
}

.related_project-card_title {
  @apply justify-end items-end w-full h-1/3 bg-gradient-to-b from-transparent to-black/50 rounded-b-2xl gap-2 absolute bottom-0 right-0 font-semibold text-lg text-white p-4;
}

.related_projects-grid {
  @apply grid xl:grid-cols-4 md:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-8 mt-5;
}

/* Custom Menu */
.custom_menu-btn {
  @apply gap-4 w-full rounded-md bg-light-white-100 p-4 text-base outline-none capitalize;
}

.custom_menu-items {
  @apply flex-col absolute left-0 mt-2 xs:min-w-[300px] w-fit max-h-64 origin-top-right rounded-xl bg-white border border-nav-border shadow-menu overflow-y-auto;
}

.custom_menu-item {
  @apply text-left w-full px-5 py-2 text-sm hover:bg-light-white-100 self-start whitespace-nowrap capitalize;
}

/* Footer */
.footer {
  @apply flex-col paddings w-full gap-20 bg-light-white;
}

.footer_copyright {
  @apply max-sm:flex-col w-full text-sm font-normal;
}

.footer_column {
  @apply flex-1 flex flex-col gap-3 text-sm min-w-max;
}

/* Form Field */
.form_field-input {
  @apply w-full outline-0 bg-light-white-100 rounded-xl p-4;
}

/* Modal */
.modal {
  @apply fixed z-10 left-0 right-0 top-0 bottom-0 mx-auto bg-black/80;
}

.modal_wrapper {
  @apply flex justify-start items-center flex-col absolute h-[95%] w-full bottom-0 bg-white rounded-t-3xl lg:px-40 px-8 pt-14 pb-72 overflow-auto;
}

/* Navbar */
.navbar {
  @apply py-5 px-8 border-b border-nav-border gap-4;
}

/* Profile Menu */
.profile_menu-items {
  @apply flex-col absolute right-1/2 translate-x-1/2 mt-3 p-7 sm:min-w-[300px] min-w-max rounded-xl bg-white border border-nav-border shadow-menu;
}

/* Profile Card */
.profile_card-title {
  @apply justify-end items-end w-full h-1/3 bg-gradient-to-b from-transparent to-black/50 rounded-b-2xl gap-2 absolute bottom-0 right-0 font-semibold text-lg text-white p-4;
}

/* Project Form */
.form {
  @apply flex-col w-full lg:pt-24 pt-12 gap-10 text-lg max-w-5xl mx-auto;
}

.form_image-container {
  @apply w-full lg:min-h-[400px] min-h-[200px] relative;
}

.form_image-label {
  @apply z-10 text-center w-full h-full p-20 text-gray-100 border-2 border-gray-50 border-dashed;
}

.form_image-input {
  @apply absolute z-30 w-full opacity-0 h-full cursor-pointer;
}

/* Profile Projects */
.profile_projects {
  @apply grid xl:grid-cols-4 md:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-8 mt-5;
}
graphqlQueriesAndMutations.ts
export const createProjectMutation = `
	mutation CreateProject($input: ProjectCreateInput!) {
		projectCreate(input: $input) {
			project {
				id
				title
				description
				createdBy {
					email
					name
				}
			}
		}
	}
`;

export const updateProjectMutation = `
	mutation UpdateProject($id: ID!, $input: ProjectUpdateInput!) {
		projectUpdate(by: { id: $id }, input: $input) {
			project {
				id
				title
				description
				createdBy {
					email
					name
				}
			}
		}
	}
`;

export const deleteProjectMutation = `
  mutation DeleteProject($id: ID!) {
    projectDelete(by: { id: $id }) {
      deletedId
    }
  }
`;
      
export const createUserMutation = `
	mutation CreateUser($input: UserCreateInput!) {
		userCreate(input: $input) {
			user {
				name
				email
				avatarUrl
				description
				githubUrl
				linkedinUrl
				id
			}
		}
	}
`;

export const projectsQuery = `
  query getProjects($category: String, $endCursor: String) {
    projectSearch(first: 8, after: $endCursor, filter: {category: {eq: $category}}) {
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
      edges {
        node {
          title
          githubUrl
          description
          liveSiteUrl
          id
          image
          category
          createdBy {
            id
            email
            name
            avatarUrl
          }
        }
      }
    }
  }
`;

export const getProjectByIdQuery = `
  query GetProjectById($id: ID!) {
    project(by: { id: $id }) {
      id
      title
      description
      image
      liveSiteUrl
      githubUrl
      category
      createdBy {
        id
        name
        email
        avatarUrl
      }
    }
  }
`;

export const getUserQuery = `
  query GetUser($email: String!) {
    user(by: { email: $email }) {
      id
      name
      email
      avatarUrl
      description
      githubUrl
      linkedinUrl
    }
  }
`;
      
export const getProjectsOfUserQuery = `
  query getUserProjects($id: ID!, $last: Int = 4) {
    user(by: { id: $id }) {
      id
      name
      email
      description
      avatarUrl
      githubUrl
      linkedinUrl
      projects(last: $last) {
        edges {
          node {
            id
            title
            image
          }
        }
      }
    }
  }
`;
ProfileMenu.tsx
"use client"

import Link from "next/link";
import Image from "next/image";
import { signOut } from "next-auth/react";
import { Fragment, useState } from "react";
import { Menu, Transition } from "@headlessui/react";

import { SessionInterface } from "@/common.types";

const ProfileMenu = ({ session }: { session: SessionInterface }) => {
    const [openModal, setOpenModal] = useState(false);

    return (
        <div className="flexCenter z-10 flex-col relative">
            <Menu as="div">
                <Menu.Button className="flexCenter" onMouseEnter={() => setOpenModal(true)} >
                    {session?.user?.image && (
                        <Image
                            src={session.user.image}
                            width={40}
                            height={40}
                            className="rounded-full"
                            alt="user profile image"
                        />
                    )}
                </Menu.Button>

                <Transition
                    show={openModal}
                    as={Fragment}
                    enter="transition ease-out duration-200"
                    enterFrom="transform opacity-0 scale-95"
                    enterTo="transform opacity-100 scale-100"
                    leave="transition ease-in duration-75"
                    leaveFrom="transform opacity-100 scale-100"
                    leaveTo="transform opacity-0 scale-95"
                >
                    <Menu.Items
                        static
                        className="flexStart profile_menu-items"
                        onMouseLeave={() => setOpenModal(false)}
                    >
                        <div className="flex flex-col items-center gap-y-4">
                            {session?.user?.image && (
                                <Image
                                    src={session?.user?.image}
                                    className="rounded-full"
                                    width={80}
                                    height={80}
                                    alt="profile Image"
                                />
                            )}
                            <p className="font-semibold">{session?.user?.name}</p>
                        </div>

                        <div className="flex flex-col gap-3 pt-10 items-start w-full">
                            <Menu.Item>
                                <Link href={`/profile/${session?.user?.id}`} className="text-sm">Work Preferences</Link>
                            </Menu.Item>
                            <Menu.Item>
                                <Link href={`/profile/${session?.user?.id}`} className="text-sm">Settings</Link>
                            </Menu.Item>
                            <Menu.Item>
                                <Link href={`/profile/${session?.user?.id}`} className="text-sm">Profile</Link>
                            </Menu.Item>
                        </div>
                        <div className="w-full flexStart border-t border-nav-border mt-5 pt-5">
                            <Menu.Item>
                                <button type="button" className="text-sm" onClick={() => signOut()}> 
                                    Sign out
                                </button>
                            </Menu.Item>
                        </div>
                    </Menu.Items>
                </Transition>
            </Menu>
        </div>
    )
}

export default ProfileMenu
ProfilePage.tsx
import { ProjectInterface, UserProfile } from '@/common.types'
import Image from 'next/image'

import Link from 'next/link'
import Button from "./Button";
import ProjectCard from './ProjectCard';

type Props = {
    user: UserProfile;
}

const ProfilePage = ({ user }: Props) => (
    <section className='flexCenter flex-col max-w-10xl w-full mx-auto paddings'>
        <section className="flexBetween max-lg:flex-col gap-10 w-full">
            <div className='flex items-start flex-col w-full'>
                <Image src={user?.avatarUrl} width={100} height={100} className="rounded-full" alt="user image" />
                <p className="text-4xl font-bold mt-10">{user?.name}</p>
                <p className="md:text-5xl text-3xl font-extrabold md:mt-10 mt-5 max-w-lg">I’m Software Engineer at JSM 👋</p>
                
                <div className="flex mt-8 gap-5 w-full flex-wrap">
                    <Button 
                        title="Follow" 
                        leftIcon="/plus-round.svg" 
                        bgColor="bg-light-white-400 !w-max" 
                        textColor="text-black-100" 
                    />
                    <Link href={`mailto:${user?.email}`}>
                        <Button title="Hire Me" leftIcon="/email.svg" />
                    </Link>
                </div>
            </div>

            {user?.projects?.edges?.length > 0 ? (
                <Image
                    src={user?.projects?.edges[0]?.node?.image}
                    alt="project image"
                    width={739}
                    height={554}
                    className='rounded-xl object-contain'
                />
            ) : (
                <Image
                    src="/profile-post.png"
                    width={739}
                    height={554}
                    alt="project image"
                    className='rounded-xl'
                />
            )}
       </section>

       <section className="flexStart flex-col lg:mt-28 mt-16 w-full">
           <p className="w-full text-left text-lg font-semibold">Recent Work</p>
           
           <div className="profile_projects">
                {user?.projects?.edges?.map(
                    ({ node }: { node: ProjectInterface }) => (
                        <ProjectCard
                            key={`${node?.id}`}
                            id={node?.id}
                            image={node?.image}
                            title={node?.title}
                            name={user.name}
                            avatarUrl={user.avatarUrl}
                            userId={user.id}
                        />
                    )
                )}
            </div>
       </section>
   </section>
)

export default ProfilePage
projectPage.tsx
import Image from "next/image"
import Link from "next/link"

import { getCurrentUser } from "@/lib/session"
import { getProjectDetails } from "@/lib/actions"
import Modal from "@/components/Modal"
// import ProjectActions from "@/components/ProjectActions"
import RelatedProjects from "@/components/RelatedProjects"
import { ProjectInterface } from "@/common.types"
import ProjectActions from "@/components/ProjectActions"

const Project = async ({ params: { id } }: { params: { id: string } }) => {
    const session = await getCurrentUser()
    const result = await getProjectDetails(id) as { project?: ProjectInterface}

    if (!result?.project) return (
        <p className="no-result-text">Failed to fetch project info</p>
    )

    const projectDetails = result?.project

    const renderLink = () => `/profile/${projectDetails?.createdBy?.id}`

    return (
        <Modal>
            <section className="flexBetween gap-y-8 max-w-4xl max-xs:flex-col w-full">
                <div className="flex-1 flex items-start gap-5 w-full max-xs:flex-col">
                    <Link href={renderLink()}>
                        <Image
                            src={projectDetails?.createdBy?.avatarUrl}
                            width={50}
                            height={50}
                            alt="profile"
                            className="rounded-full"
                        />
                    </Link>

                    <div className="flex-1 flexStart flex-col gap-1">
                        <p className="self-start text-lg font-semibold">
                            {projectDetails?.title}
                        </p>
                        <div className="user-info">
                            <Link href={renderLink()}>
                                {projectDetails?.createdBy?.name}
                            </Link>
                            <Image src="/dot.svg" width={4} height={4} alt="dot" />
                            <Link href={`/?category=${projectDetails.category}`} className="text-primary-purple font-semibold"> 
                                {projectDetails?.category}
                            </Link>
                        </div>
                    </div>
                </div>

                {session?.user?.email === projectDetails?.createdBy?.email && (
                    <div className="flex justify-end items-center gap-2">
                        <ProjectActions projectId={projectDetails?.id} />
                    </div>
                )}
            </section>

            <section className="mt-14">
                <Image
                    src={`${projectDetails?.image}`}
                    className="object-cover rounded-2xl"
                    width={1064}
                    height={798}
                    alt="poster"
                />
            </section>

            <section className="flexCenter flex-col mt-20">
                <p className="max-w-5xl text-xl font-normal">
                    {projectDetails?.description}
                </p>

                <div className="flex flex-wrap mt-5 gap-5">
                    <Link href={projectDetails?.githubUrl} target="_blank" rel="noreferrer" className="flexCenter gap-2 tex-sm font-medium text-primary-purple">
                        🖥 <span className="underline">Github</span> 
                    </Link>
                    <Image src="/dot.svg" width={4} height={4} alt="dot" />
                    <Link href={projectDetails?.liveSiteUrl} target="_blank" rel="noreferrer" className="flexCenter gap-2 tex-sm font-medium text-primary-purple">
                        🚀 <span className="underline">Live Site</span> 
                    </Link>
                </div>
            </section>
      
            <section className="flexCenter w-full gap-8 mt-28">
                <span className="w-full h-0.5 bg-light-white-200" />
                <Link href={renderLink()} className="min-w-[82px] h-[82px]">
                    <Image
                        src={projectDetails?.createdBy?.avatarUrl}
                        className="rounded-full"
                        width={82}
                        height={82}
                        alt="profile image"
                    />
                </Link>
                <span className="w-full h-0.5 bg-light-white-200" />
            </section>

            <RelatedProjects userId={projectDetails?.createdBy?.id} projectId={projectDetails?.id} />
        </Modal>
    )
}

export default Project
tailwind.config.ts
tailwind.config.ts
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    './pages/**/*.{js,ts,jsx,tsx,mdx}',
    './components/**/*.{js,ts,jsx,tsx,mdx}',
    './app/**/*.{js,ts,jsx,tsx,mdx}',
  ],
  theme: {
    extend: {
      colors: {
        'nav-border': '#EBEAEA',
        'light-white': '#FAFAFB',
        'light-white-100': '#F1F4F5',
        'light-white-200': '#d7d7d7',
        'light-white-300': '#F3F3F4',
        'light-white-400': '#E2E5F1',
        'light-white-500': '#E4E4E4',
        gray: '#4D4A4A',
        'gray-100': '#3d3d4e',
        'black-100': '#252525',
        'primary-purple': '#9747FF',
        'gray-50': '#D9D9D9',
      },
      boxShadow: {
        menu: '0px 159px 95px rgba(13,12,34,0.01), 0px 71px 71px rgba(13,12,34,0.02), 0px 18px 39px rgba(13,12,34,0.02), 0px 0px 0px rgba(13,12,34,0.02)',
      },
      screens: {
        'xs': '400px',
      },
      maxWidth: {
        '10xl': '1680px'
      }
    },
  },
  plugins: [],
};

Assets used in the project here

Advance your skills with Next.js 14 Pro Course

Enjoyed creating this project? Dive deeper into our PRO courses for a richer learning adventure. They're packed with detailed explanations, cool features, and exercises to boost your skills. Give it a go!

Project Banner

Accelerate your professional journey with the Expert Training program

And if you're hungry for more than just a course and want to understand how we learn and tackle tech challenges, hop into our personalized masterclass. We cover best practices, different web skills, and offer mentorship to boost your confidence. Let's learn and grow together!

Project Banner

project_nextjs13_flexibble's People

Contributors

adrianhajdin avatar sujatagunale avatar tidbitsjs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

project_nextjs13_flexibble's Issues

Edges from GetProjects query are undefined

i cant get projects in the app/page.tsx , when i do console.log(data?.ProjectSearch?.edges) it return undefined , but when i do console.log(data) i see that edges is [ [Object] , [ Object ], [ Object ] ] , so i have three projects but i can't use them

Application error: a server-side exception has occurred (see the server logs for more information).

ClientError: Field 'category': Error { message: "Field 'category': Error { message: "invalid type: null, expected a string", extensions: None }", extensions: None }: {"response":{"data":null,"errors":[{"message":"Field 'category': Error { message: "Field 'category': Error { message: \"invalid type: null, expected a string\", extensions: None }", extensions: None }","locations":[{"line":3,"column":5}],"path":["projectSearch"]}],"status":200,"headers":{}},"request":{"query":"\n query getProjects($category: String, $endcursor: String) {\n projectSearch(first: 8, after: $endcursor, filter: {category: {eq: $category}}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n node {\n title\n githubUrl\n description\n liveSiteUrl\n id\n image\n category\n createdBy {\n id\n email\n name\n avatarUrl\n }\n }\n }\n }\n }\n","variables":{}}}
at makeRequest (/var/task/node_modules/graphql-request/build/cjs/index.js:310:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async makeGraphQLRequest (/var/task/.next/server/chunks/634.js:191:16)
at async Home (/var/task/.next/server/app/page.js:645:18) {
response: {
data: null,
errors: [ [Object] ],
status: 200,
headers: Headers { [Symbol(map)]: [Object: null prototype] }
},
request: {
query: '\n' +
' query getProjects($category: String, $endcursor: String) {\n' +
' projectSearch(first: 8, after: $endcursor, filter: {category: {eq: $category}}) {\n' +
' pageInfo {\n' +
' hasNextPage\n' +
' hasPreviousPage\n' +
' startCursor\n' +
' endCursor\n' +
' }\n' +
' edges {\n' +
' node {\n' +
' title\n' +
' githubUrl\n' +
' description\n' +
' liveSiteUrl\n' +
' id\n' +
' image\n' +
' category\n' +
' createdBy {\n' +
' id\n' +
' email\n' +
' name\n' +
' avatarUrl\n' +
' }\n' +
' }\n' +
' }\n' +
' }\n' +
' }\n',
variables: { category: undefined, endcursor: undefined }
}
}
[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
digest: '2723824341'
}

@apply not working

here it is snippet from globals.css

`@tailwind base;
@tailwind components;
@tailwind utilities;

  • {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    }

body {
font-family: Inter;
}

.flexCenter {
@apply flex justify-center items-center;
}

.flexBetween {
@apply flex justify-between items-center;
}`

i imported the file into layout import './globals.css'

i do the config correctly but nothing work from pesudo classs for example

flexBetween not working

i tried to edit my sitting as this https://stackoverflow.com/questions/74238283/tailwind-css-apply-not-working-with-pseudo-classes

but still nothing

Application error: a client-side exception has occurred (see the browser console for more information). Digest: 3304712560

after deploy to vercel , it has the following error.
Application error: a client-side exception has occurred (see the browser console for more information).
Digest: 3304712560

from the console. it said
"Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.
window.console.error @ 769-39f2b976c694cbdf.js:1"

http://localhost:3000/api/auth/token returning Bad Request: Error: This action with HTTP GET is not supported by NextAuth.js

I am having an issue getting token when creating a project and this function
export const fetchToken = async () => {
try {
const response = await fetch(${serverUrl}/api/auth/token);
return response.json();
} catch (error) {
throw error;
}
}

is returning a response of 400 - Bad request and on my network tab during project creation the response i get from token access is
Error: This action with HTTP GET is not supported by NextAuth.js

the error at my console is
actions.ts:15 GET http://localhost:3000/api/auth/token 400 (Bad Request)

i need help , i can t log in using google

Error checking if user exists:
Variable "email" of type "String!" used in position expecting type "Email": {"response":{"data":null,"errors":[{"message":"Variable "email" of type "String!" used in position expecting type
"Email"","locations":[{"line":2,"column":17},{"line":3,"column":5}]}],"status":200,"headers":{}},"request":{"query":"\n query GetUser($email: String!) {\n user(by: { email: $email }) {\n id\n name\n
email\n avatarUrl\n description\n githubUrl\n linkedinUrl\n }\n }\n","variables":{"email":"[email protected]"}}}

Internal Server Error 500 in uploading image to CLOUDINARY

Facing the same Internal Server Error when adding a project to, when i checked in the networking section it shows the 500 internal server error in uploading the image to cloudinary, I've doubled checked my env files and everything but nothing seems to be working
image
here's ss of my env file please someone look into this

error in getCurrentUser()

export async function getCurrentUser() {

85 | const session = (await getServerSession(authOptions)) as SessionInterface;
| ^
86 |
87 | return session;
88 | }
error in this code and error message is unhandeled runtime error

JWT Malformed

image

This is the screenshot for my error. What should I do for me to get rid of this error? Thank you so much guys.

JsonWebTokenError,graphql failed ,signIn error

[next-auth][warn][EXPERIMENTAL_API]
getServerSession is used in a React Server Component.
https://next-auth.js.org/configuration/nextjs#getServerSession}
https://next-auth.js.org/warnings#EXPERIMENTAL_API
[next-auth][error][JWT_SESSION_ERROR]
https://next-auth.js.org/errors#jwt_session_error jwt malformed {
message: 'jwt malformed',
stack: 'JsonWebTokenError: jwt malformed\n' +
' at module.exports [as verify] (webpack-internal:///(rsc)/./node_modules/jsonwebtoken/verify.js:72:21)\n' +
' at Object.decode (webpack-internal:///(rsc)/./lib/session.ts:32:86)\n' +
' at Object.session (webpack-internal:///(rsc)/./node_modules/next-auth/core/routes/session.js:25:44)\n' +
' at AuthHandler (webpack-internal:///(rsc)/./node_modules/next-auth/core/index.js:161:50)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
' at async getServerSession (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:129:21)\n' +
' at async getCurrentUser (webpack-internal:///(rsc)/./lib/session.ts:73:21)\n' +
' at async Navbar (webpack-internal:///(rsc)/./components/Navbar.tsx:21:21)',
name: 'JsonWebTokenError'
}

  • warn ./node_modules/node-fetch/lib/index.js
    Module not found: Can't resolve 'encoding' in 'C:\New folder n\jsmastery\dribble\node_modules\node-fetch\lib'

Import trace for requested module:
./node_modules/node-fetch/lib/index.js
./node_modules/cross-fetch/dist/node-ponyfill.js
./node_modules/graphql-request/build/esm/index.js
./lib/actions.ts
./lib/session.ts
./components/Navbar.tsx
./app/layout.tsx

  • wait compiling /api/auth/[...nextauth]/route (client and server)...
  • warn ./node_modules/node-fetch/lib/index.js
    Module not found: Can't resolve 'encoding' in 'C:\New folder n\jsmastery\dribble\node_modules\node-fetch\lib'

Import trace for requested module:
./node_modules/node-fetch/lib/index.js
./node_modules/cross-fetch/dist/node-ponyfill.js
./node_modules/graphql-request/build/esm/index.js
./lib/actions.ts
./lib/session.ts
./components/Navbar.tsx
./app/layout.tsx
Error checking if user exists: request to http://127.0.0.1:4000/graphql failed, reason: connect ECONNREFUSED 127.0.0.1:4000

Error while adding grafbase init

When I use 'grafbase init --config-format typescript', I get this error:

"grafbase : The term 'grafbase' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1

  • grafbase init --config-format typescript
  •   + CategoryInfo          : ObjectNotFound: (grafbase:String) [],   
     CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException"
    

ClientError: Unauthorized to access Mutation.userCreate (missing create operation):

I am getting this issue while signing in

ClientError: Unauthorized to access Mutation.userCreate (missing create operation): {"response":{"data":null,"errors":[{"message":"Unauthorized to access Mutation.userCreate (missing create operation)"}],"status":200,"headers":{}},"request":{"query":"\n\tmutation CreateUser($input: UserCreateInput!) {\n\t\tuserCreate(input: $input) {\n\t\t\tuser {\n\t\t\t\tname\n\t\t\t\temail\n\t\t\t\tavatarUrl\n\t\t\t\tdescription\n\t\t\t\tgithubUrl\n\t\t\t\tlinkedInUrl\n\t\t\t\tid\n\t\t\t}\n\t\t}\n\t}\n","variables":{"variables":{"input":{"name":"Salman Sheriff","email":"[email protected]","avatarUrl":"https://avatars.githubusercontent.com/u/95226945?v=4"}}}}}
at makeRequest (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/graphql-request/build/esm/index.js:288:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async makeGraphQLRequest (webpack-internal:///(sc_server)/./src/lib/actions.ts:17:16)
at async Object.signIn (webpack-internal:///(sc_server)/./src/lib/session/index.ts:55:21)
at async Object.callback (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/core/routes/callback.js:49:39)
at async AuthHandler (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/core/index.js:202:38)
at async NextAuthRouteHandler (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/next/index.js:49:30)
at async NextAuth._args$ (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/next/index.js:83:24)
at async eval (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/future/route-modules/app-route/module.js:265:37) {
response: {
data: null,
errors: [ [Object] ],
status: 200,
headers: Headers { [Symbol(map)]: [Object: null prototype] }
},
request: {
query: '\n' +
'\tmutation CreateUser($input: UserCreateInput!) {\n' +
'\t\tuserCreate(input: $input) {\n' +
'\t\t\tuser {\n' +
'\t\t\t\tname\n' +
'\t\t\t\temail\n' +
'\t\t\t\tavatarUrl\n' +
'\t\t\t\tdescription\n' +
'\t\t\t\tgithubUrl\n' +
'\t\t\t\tlinkedInUrl\n' +
'\t\t\t\tid\n' +
'\t\t\t}\n' +
'\t\t}\n' +
'\t}\n',

variables: { variables: [Object] }

}
}

sdfsdf

favicon.ico missing

I @adrianhajdin,

I hope you are well.

I would like inform you that there is no favicon.ico inside the public unzipped assets. 😊
I will create mine yet I'd like to let you know just in case some students need it.

regards

@stephanemalho

Error 500

i get a server 500 error post and the response says 'Failed to upload image on Cloudinary'

i have been looking for a while where the mistake is but can't find anaything can somone maybe help

importing AdapterUser from next-auth/adapters showing module not found

while importing AdapterUser from next-auth/adapters showing module not found and its type declaration i tried almost all possible ways to resolve it.

import { getServerSession } from "next-auth/next";
import { NextAuthOptions, User } from "next-auth";
import { AdapterUser } from "next-auth/adapters";
import GoogleProvider from "next-auth/providers/google";
import jsonwebtoken from "jsonwebtoken";
import { JWT } from "next-auth/jwt";
import { SessionInterface } from "@/common.types";

export const authOptions: NextAuthOptions = {
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
}),
],
// jwt: {
// encode: ({ secret, token }) => {},
// decode: async ({ secret, token }) => {},
// },
// theme: {
// colorScheme: "light",
// logo: "/logo.png",
// },
callbacks: {
async session({ session }) {
return session;
},
async signIn({ user }: { user: AdapterUser | User }) {
try {
// get the user if they exist
/// if not create a new user
///return true if they exist or logged in
return true;
} catch (error: any) {
console.log(error);
return false;
}
},
},
};

Grafbase and MongoDB

Hey everyone, I'm aware of the issues with Grafbase and that it doesn't work anymore.
I've seen the comment on the YouTube video about using MongoDB and tweaking some stuff but I'm still learning, I watched a few YouTube videos and I still can't manage to fix it, I skipped the Grafbase after copying and pasting what Adrian coded in the Grafbase config and I have this error now:
https://prnt.sc/x8YEVnyD-icf
Can anyone explain what files I have to edit or what to add and everything? I really want to bypass the database section. THANKS!

Error: Unauthorized: {"response":{"data":null,"errors":[{"message":"Unauthorized"}],"status":200

Error: Unauthorized: {"response":{"data":null,"errors":[{"message":"Unauthorized"}],"status":200,"headers":{"map":{"access-control-allow-origin":"","access-control-expose-headers":"","content-length":"51","content-type":"application/json;charset=UTF-8","date":"Tue, 24 Oct 2023 03:56:14 GMT","vary":"origin, access-control-request-method, access-control-request-headers"}}},"request":{"query":"\n\tmutation CreateProject($input: ProjectCreateInput!) {\n\t\tprojectCreate(input: $input) {\n\t\t\tproject {\n\t\t\t\tid\n\t\t\t\ttitle\n\t\t\t\tdescription\n\n\n\t\t\t\tcreatedBy {\n\t\t\t\t\temail\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n","variables":{"input":{"title":"qe","description":"eq","image":"http://res.cloudinary.com/depfldi7y/image/upload/v1698119773/q6aweuk8o2ryfxwgqvs1.png","components":"qe","liveSiteUrl":"https://goggle.com","githubUrl":"https://goggle.com","category":"Computer-Sci","createdBy":{"link":"user_01HD8R63T1D69XBD50FX5PAV33"}}}}}
at makeRequest (webpack-internal:///(app-pages-browser)/./node_modules/graphql-request/build/esm/index.js:301:15)
at async makeGraphQLRequest (webpack-internal:///(app-pages-browser)/./lib/actions.ts:22:16)
at async handleFormSubmit (webpack-internal:///(app-pages-browser)/./components/ProjectForm.tsx:35:17)

I check everything but still i dont know why I'm getting this. There is no data in grafbase

Unhandled Runtime Error

Error: Field 'category': Error { message: "Field 'category': Error { message: "invalid type: null, expected a string", extensions: None }", extensions: None }: {"response":{"data":null,"errors":[{"message":"Field 'category': Error { message: "Field 'category': Error { message: \"invalid type: null, expected a string\", extensions: None }", extensions: None }","locations":[{"line":3,"column":5}],"path":["projectSearch"]}],"status":200,"headers":{}},"request":{"query":"\n query getProjects($category: String, $endcursor: String) {\n projectSearch(first: 8, after: $endcursor, filter: {category: {eq: $category}}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n node {\n title\n githubUrl\n description\n liveSiteUrl\n id\n image\n category\n createdBy {\n id\n email\n name\n avatarUrl\n }\n }\n }\n }\n }\n","variables":{}}}

51 | const makeGraphQLRequest = async (query: string, variables = {}) => {
52 | try {

53 | return await client.request(query, variables)
| ^
54 | } catch (err) {
55 | throw err
56 | }

It says that from category in lib/actions.ts from the makeGraphLRequest is returning a null, and expecting a string? Any solutions?

Deployment building error

I am getting the error while deploying it. Error shows like this:

[17:52:30.711] Running build in Washington, D.C., USA (East) – iad1
[17:52:30.857] Cloning github.com/1999-sahil/geekgazette-nextjs-app (Branch: main, Commit: 47cdc17)
[17:52:30.867] Skipping build cache, deployment was triggered without cache.
[17:52:31.146] Cloning completed: 289.245ms
[17:52:31.487] Running "vercel build"
[17:52:32.001] Vercel CLI 32.6.1
[17:52:32.406] Installing dependencies...
[17:52:47.304]
[17:52:47.308] added 168 packages in 14s
[17:52:47.308]
[17:52:47.308] 29 packages are looking for funding
[17:52:47.308] run npm fund for details
[17:52:47.348] Detected Next.js version: 13.4.19
[17:52:47.358] Detected package-lock.json generated by npm 7+
[17:52:47.360] Running "npm run build"
[17:52:49.519]
[17:52:49.519] > [email protected] build
[17:52:49.519] > next build
[17:52:49.519]
[17:52:50.025] - warn You have enabled experimental feature (serverComponentsExternalPackages) in next.config.js.
[17:52:50.026] - warn Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
[17:52:50.026]
[17:52:50.053] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[17:52:50.053] This information is used to shape Next.js' roadmap and prioritize features.
[17:52:50.053] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[17:52:50.054] https://nextjs.org/telemetry
[17:52:50.054]
[17:52:50.150] - info Creating an optimized production build...
[17:53:15.311] - warn Compiled with warnings
[17:53:15.311]
[17:53:15.312] ./node_modules/node-fetch/lib/index.js
[17:53:15.312] Module not found: Can't resolve 'encoding' in '/vercel/path0/node_modules/node-fetch/lib'
[17:53:15.312]
[17:53:15.312] Import trace for requested module:
[17:53:15.312] ./node_modules/node-fetch/lib/index.js
[17:53:15.312] ./node_modules/cross-fetch/dist/node-ponyfill.js
[17:53:15.312] ./node_modules/graphql-request/build/esm/index.js
[17:53:15.312] ./lib/actions.ts
[17:53:15.312] ./components/ProjectForm.tsx
[17:53:15.312]
[17:53:15.314] - info Linting and checking validity of types...
[17:53:21.348] Failed to compile.
[17:53:21.348]
[17:53:21.348] ./app/project/[id]/page.tsx:30:29
[17:53:21.348] Type error: Type 'string | undefined' is not assignable to type 'string | StaticImport'.
[17:53:21.348]
[17:53:21.348] �[0m �[90m 28 | �[39m �[33m<�[39m�[33mLink�[39m href�[33m=�[39m{renderLink()}�[33m>�[39m�[0m
[17:53:21.349] �[0m �[90m 29 | �[39m �[33m<�[39m�[33mImage�[39m�[0m
[17:53:21.349] �[0m�[31m�[1m>�[22m�[39m�[90m 30 | �[39m src�[33m=�[39m{projectDetails�[33m?�[39m�[33m.�[39mcreatedBy�[33m?�[39m�[33m.�[39mavatarUrl}�[0m
[17:53:21.349] �[0m �[90m | �[39m �[31m�[1m^�[22m�[39m�[0m
[17:53:21.349] �[0m �[90m 31 | �[39m width�[33m=�[39m{�[35m50�[39m}�[0m
[17:53:21.349] �[0m �[90m 32 | �[39m height�[33m=�[39m{�[35m50�[39m}�[0m
[17:53:21.349] �[0m �[90m 33 | �[39m alt�[33m=�[39m�[32m"profile"�[39m�[0m
[17:53:21.463] Error: Command "npm run build" exited with 1
[17:53:21.796]

Please help me to resolve this issue.

Navbar's links causes hydration issues.

In case this error and warning appears:

"Error: Hydration failed because the initial UI does not match what was rendered on the server.
Warning: Expected server HTML to contain a matching <ul> in <a>"

Cause:

<Link href="/">
         <Image
         src="/logo.svg"
         width={115}
         height={43}
         alt='Flexible'
         />

         <ul className='xl:flex hidden text-small gap-7'>
           {NavLinks.map(link => (
               <Link href={link.href} key={link.key}>
                 {link.text}
               </Link>
           ))}
         </ul>
      </Link>

Solution: Move the to enclose the Image

<Link href="/">
         <Image
         src="/logo.svg"
         width={115}
         height={43}
         alt='Flexible'
         />
</Link>
         <ul className='xl:flex hidden text-small gap-7'>
           {NavLinks.map(link => (
               <Link href={link.href} key={link.key}>
                 {link.text}
               </Link>
           ))}
         </ul>
     

An error occurred in the Server Components render

code is working in localhost but giving this error when deploying on vercel this is my repo - https://github.com/Santosh7017/flexibble

ClientError: GraphQL Error (Code: 503): {"response":{"error":"config worker not available","status":503,"headers":{}},"request":{"query":"\n query getProjects($category: String, $endcursor: String) {\n projectSearch(first: 8, after: $endcursor, filter: {category: {eq: $category}}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n node {\n title\n githubUrl\n description\n liveSiteUrl\n id\n image\n category\n createdBy {\n id\n email\n name\n avatarUrl\n }\n }\n }\n }\n }\n","variables":{}}}
at makeRequest (/var/task/node_modules/graphql-request/build/cjs/index.js:310:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async makeGraphQLRequest (/var/task/.next/server/chunks/147.js:170:16)
at async Home (/var/task/.next/server/app/page.js:540:18) {
response: {
error: 'config worker not available',
status: 503,
headers: Headers { [Symbol(map)]: [Object: null prototype] }
},
request: {
query: '\n' +
' query getProjects($category: String, $endcursor: String) {\n' +
' projectSearch(first: 8, after: $endcursor, filter: {category: {eq: $category}}) {\n' +
' pageInfo {\n' +
' hasNextPage\n' +
' hasPreviousPage\n' +
' startCursor\n' +
' endCursor\n' +
' }\n' +
' edges {\n' +
' node {\n' +
' title\n' +
' githubUrl\n' +
' description\n' +
' liveSiteUrl\n' +
' id\n' +
' image\n' +
' category\n' +
' createdBy {\n' +
' id\n' +
' email\n' +
' name\n' +
' avatarUrl\n' +
' }\n' +
' }\n' +
' }\n' +
' }\n' +
' }\n',
variables: { category: undefined, endcursor: undefined }
}
}
[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
digest: '814287263'
}

Error: GraphQL Error (Code: 200):

Error: GraphQL Error (Code: 200): {"response":{"error":"{"data":null,"errors":[{"message":"Unauthorized"}]}","status":200,"headers":{"map":{"content-length":"51","content-type":"text/xml"}}},"request":{"query":"\n\tmutation CreateProject($input: ProjectCreateInput!) {\n\t\tprojectCreate(input: $input) {\n\t\t\tproject {\n\t\t\t\tid\n\t\t\t\ttitle\n\t\t\t\tdescription\n\t\t\t\tcreatedBy {\n\t\t\t\t\temail\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n","variables":{"input":{"title":"jdgj","description":"djGDJ","image":"http://res.cloudinary.com/djzh0decn/image/upload/v1689633257/nxmwx4ikbcbly9cmglft.png","category":"","createdBy":{"link":"user_01H4KEB5YXHB02M6M6EC9N08Y1"}}}}}
at makeRequest (webpack-internal:///(:3000/app-client)/./node_modules/graphql-request/build/esm/index.js:301:15)
at async makeGraphQLRequest (webpack-internal:///(:3000/app-client)/./lib/actions.ts:43:16)
at async handleFormSubmit (webpack-internal:///(:3000/app-client)/./components/ProjectForm.tsx:35:17)

Project is not Creating After Deploying on vercel

i solved the authentication error by adding the one of the production deployment links in the google cloud redirect URI (because for some reason it is not taking the actual domain that has been provided by vercel its showing access denied on that, later when i moved to creating a project it showed a 308, i thought there might be something wrong with my NEXT_PUBLIC_SERVER_URL as so i changed it to the same url as the google cloud production deployment url (ex:- https://vercel.com/valkonx33/code-vault/6o37o1LxqFSGQ293tzu7oJAugPkC)
its throwing 200 now but token is not passing
image

idk what i'm doing wrong but its not working i need help urgent please

Error: Field 'category'

Error: Field 'category': Error { message: "Field 'category': Error { message: "invalid type: null, expected a string", extensions: None }", extensions: None }: {"response":{"data":null,"errors":[{"message":"Field 'category': Error { message: "Field 'category': Error { message: \"invalid type: null, expected a string\", extensions: None }", extensions: None }","locations":[{"line":3,"column":5}],"path":["projectSearch"]}],"status":200,"headers":{}},"request":{"query":"\n query getProjects($category: String, $endcursor: String) {\n projectSearch(first: 8, after: $endcursor, filter: {category: {eq: $category}}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n node {\n title\n githubUrl\n description\n liveSiteUrl\n id\n image\n category\n createdBy {\n id\n email\n name\n avatarUrl\n }\n }\n }\n }\n }\n","variables":{}}}

Source
lib\actions.ts (38:11) @ async makeGraphQLRequest

36 | const makeGraphQLRequest = async (query: string, variables = {}) => {
37 | try {
38 | return await client.request(query, variables);
39 | } catch (err) {
40 | throw err;
41 | }

The error is at line 38.

Unhandled Runtime Error Error: Field 'category': Error { message: "Field 'category': Error { message: \"invalid type: null, expected a string\", extensions: None }",

This is what Next.js compiler sends after i try to run up the finished application. i got this error while making the app, then i downloaded the final project and it has the same issue.

Unhandled Runtime Error
Error: Field 'category': Error { message: "Field 'category': Error { message: "invalid type: null, expected a string", extensions: None }", extensions: None }: {"response":{"data":{"projectSearch":null},"errors":[{"message":"Field 'category': Error { message: "Field 'category': Error { message: \"invalid type: null, expected a string\", extensions: None }", extensions: None }","locations":[{"line":3,"column":5}],"path":["projectSearch"]}],"status":200,"headers":{}},"request":{"query":"\n query getProjects($category: String, $endcursor: String) {\n projectSearch(first: 8, after: $endcursor, filter: {category: {eq: $category}}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n node {\n title\n githubUrl\n description\n liveSiteUrl\n id\n image\n category\n createdBy {\n id\n email\n name\n avatarUrl\n }\n }\n }\n }\n }\n","variables":{}}}

Source
lib\actions.ts (38:11) @ async makeGraphQLRequest

36 | const makeGraphQLRequest = async (query: string, variables = {}) => {
37 | try {

38 | return await client.request(query, variables);
| ^
39 | } catch (err) {
40 | throw err;
41 | }
Call Stack
async Home

Deployment Error on Vercel

Receiving Error while Deploying to vercel

[21:57:31.334] Running build in Washington, D.C., USA (East) – iad1 (Hive)
[21:57:31.435] Cloning github.com/PsionicGeek/grapfbase_flexible (Branch: main, Commit: f294d77)
[21:57:31.752] Skipping build cache, deployment was triggered without cache.
[21:57:32.009] Cloning completed: 573.454ms
[21:57:32.256] Running "vercel build"
[21:57:32.714] Vercel CLI 32.4.1
[21:57:33.155] Installing dependencies...
[21:57:42.784]
[21:57:42.784] added 165 packages in 9s
[21:57:42.785]
[21:57:42.785] 27 packages are looking for funding
[21:57:42.785] run npm fund for details
[21:57:42.803] Detected Next.js version: 13.5.6
[21:57:42.805] Detected package-lock.json generated by npm 7+
[21:57:42.806] Running "npm run build"
[21:57:43.759]
[21:57:43.759] > [email protected] build
[21:57:43.759] > next build
[21:57:43.759]
[21:57:44.372] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[21:57:44.372] This information is used to shape Next.js' roadmap and prioritize features.
[21:57:44.373] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[21:57:44.373] https://nextjs.org/telemetry
[21:57:44.373]
[21:57:44.462] Creating an optimized production build ...
[21:57:54.150] ⚠ Compiled with warnings
[21:57:54.150]
[21:57:54.151] ./node_modules/node-fetch/lib/index.js
[21:57:54.151] Module not found: Can't resolve 'encoding' in '/vercel/path0/node_modules/node-fetch/lib'
[21:57:54.151]
[21:57:54.151] Import trace for requested module:
[21:57:54.151] ./node_modules/node-fetch/lib/index.js
[21:57:54.151] ./node_modules/cross-fetch/dist/node-ponyfill.js
[21:57:54.151] ./node_modules/graphql-request/build/esm/index.js
[21:57:54.151] ./lib/actions.ts
[21:57:54.151] ./components/ProjectForm.tsx
[21:57:54.151]
[21:57:54.152] Linting and checking validity of types ...
[21:57:58.197] Failed to compile.
[21:57:58.197]
[21:57:58.197] ./components/AuthProvider.tsx:27:20
[21:57:58.198] Type error: Argument of type 'Record<LiteralUnion<BuiltInProviderType, string>, ClientSafeProvider> | null' is not assignable to parameter of type 'SetStateAction<Providers | null>'.
[21:57:58.198] Type 'Record<LiteralUnion<BuiltInProviderType, string>, ClientSafeProvider>' is not assignable to type 'SetStateAction<Providers | null>'.
[21:57:58.198] Type 'Record<LiteralUnion<BuiltInProviderType, string>, ClientSafeProvider>' is not assignable to type 'Providers'.
[21:57:58.198] 'string & Record<never, never>' and 'string' index signatures are incompatible.
[21:57:58.198] Property 'signInUrl' is missing in type 'ClientSafeProvider' but required in type 'Provider'.
[21:57:58.198]
[21:57:58.198] �[0m �[90m 25 | �[39m �[36mconst�[39m fetchProviders �[33m=�[39m �[36masync�[39m () �[33m=>�[39m {�[0m
[21:57:58.198] �[0m �[90m 26 | �[39m �[36mconst�[39m res �[33m=�[39m �[36mawait�[39m getProviders()�[33m;�[39m�[0m
[21:57:58.198] �[0m�[31m�[1m>�[22m�[39m�[90m 27 | �[39m setProviders(res)�[33m;�[39m�[0m
[21:57:58.198] �[0m �[90m | �[39m �[31m�[1m^�[22m�[39m�[0m
[21:57:58.198] �[0m �[90m 28 | �[39m }�[0m
[21:57:58.199] �[0m �[90m 29 | �[39m fetchProviders()�[33m;�[39m�[0m
[21:57:58.199] �[0m �[90m 30 | �[39m�[0m
[21:57:58.279] Error: Command "npm run build" exited with 1

Grafbase integration

I've followed every step with grafbase integration and it doesn't create the folder and the file on my project, so I copied the folder and the file from the repo and pasted them but it didn't work, I have these errors:
https://prnt.sc/gJxBWOKJJzZI
Thanks.

[next-auth][error][JWT_SESSION_ERROR]

I've followed everything and I'm stuck on this. Any help would be appreciated! I've logged the Token and it is indeed invalid but I have no idea why. Might just have to start over...

[next-auth][error][JWT_SESSION_ERROR]
https://next-auth.js.org/errors#jwt_session_error jwt malformed {
message: 'jwt malformed',
stack: 'JsonWebTokenError: jwt malformed\n' +
' at module.exports [as verify] (webpack-internal:///(rsc)/./node_modules/jsonwebtoken/verify.js:72:21)\n' +
' at Object.decode (webpack-internal:///(rsc)/./lib/session.ts:35:86)\n' +
' at Object.session (webpack-internal:///(rsc)/./node_modules/next-auth/core/routes/session.js:25:44)\n' +
' at AuthHandler (webpack-internal:///(rsc)/./node_modules/next-auth/core/index.js:161:50)\n' +
' at async getServerSession (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:125:21)\n' +
' at async getCurrentUser (webpack-internal:///(rsc)/./lib/session.ts:76:21)\n' +
' at async NavBar (webpack-internal:///(rsc)/./app/components/NavBar.tsx:23:21)',
name: 'JsonWebTokenError'
}

JWT_SESSION_ERROR

Having a hard time figuring out how to refresh JWT. It seems that it expired and now I'm not able to login to the dev website. Here is the errors that I'm getting:

- event compiled client and server successfully in 1481 ms (1336 modules)
[next-auth][warn][EXPERIMENTAL_API] 
`getServerSession` is used in a React Server Component.
https://next-auth.js.org/configuration/nextjs#getServerSession}
https://next-auth.js.org/warnings#EXPERIMENTAL_API
[next-auth][error][JWT_SESSION_ERROR]
https://next-auth.js.org/errors#jwt_session_error invalid signature {
  message: 'invalid signature',
  stack: 'JsonWebTokenError: invalid signature\n' +
    '    at eval (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/verify.js:158:25)\n' +
    '    at getSecret (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/verify.js:94:20)\n' +
    '    at module.exports [as verify] (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/verify.js:97:12)\n' +
    '    at Object.decode (webpack-internal:///(sc_server)/./lib/session.ts:32:86)\n' +
    '    at Object.session (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/core/routes/session.js:25:44)\n' +
    '    at AuthHandler (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/core/index.js:161:50)\n' +
    '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
    '    at async getServerSession (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/next/index.js:129:21)\n' +
    '    at async getCurrentUser (webpack-internal:///(sc_server)/./lib/session.ts:76:21)\n' +
    '    at async Navbar (webpack-internal:///(sc_server)/./components/Navbar.tsx:25:21)',
  name: 'JsonWebTokenError'
}
[next-auth][error][JWT_SESSION_ERROR] 
https://next-auth.js.org/errors#jwt_session_error invalid signature {
  message: 'invalid signature',
  stack: 'JsonWebTokenError: invalid signature\n' +
    '    at eval (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/verify.js:158:25)\n' +
    '    at getSecret (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/verify.js:94:20)\n' +
    '    at module.exports [as verify] (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/verify.js:97:12)\n' +
    '    at Object.decode (webpack-internal:///(sc_server)/./lib/session.ts:32:86)\n' +
    '    at Object.session (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/core/routes/session.js:25:44)\n' +
    '    at AuthHandler (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/core/index.js:161:50)\n' +
    '    at async getServerSession (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/next/index.js:129:21)\n' +
    '    at async getCurrentUser (webpack-internal:///(sc_server)/./lib/session.ts:76:21)\n' +
    '    at async Navbar (webpack-internal:///(sc_server)/./components/Navbar.tsx:25:21)',
  name: 'JsonWebTokenError'
}
[next-auth][error][JWT_SESSION_ERROR] 
https://next-auth.js.org/errors#jwt_session_error invalid signature {
  message: 'invalid signature',
  stack: 'JsonWebTokenError: invalid signature\n' +
    '    at eval (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/verify.js:158:25)\n' +
    '    at getSecret (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/verify.js:94:20)\n' +
    '    at module.exports [as verify] (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/verify.js:97:12)\n' +
    '    at Object.decode (webpack-internal:///(sc_server)/./lib/session.ts:32:86)\n' +
    '    at Object.session (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/core/routes/session.js:25:44)\n' +
    '    at AuthHandler (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/core/index.js:161:50)\n' +
    '    at async getServerSession (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/next/index.js:129:21)\n' +
    '    at async getCurrentUser (webpack-internal:///(sc_server)/./lib/session.ts:76:21)\n' +
    '    at async Navbar (webpack-internal:///(sc_server)/./components/Navbar.tsx:25:21)',
  name: 'JsonWebTokenError'
}
[next-auth][error][JWT_SESSION_ERROR] 
https://next-auth.js.org/errors#jwt_session_error invalid signature {
  message: 'invalid signature',
  stack: 'JsonWebTokenError: invalid signature\n' +
    '    at eval (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/verify.js:158:25)\n' +
    '    at getSecret (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/verify.js:94:20)\n' +
    '    at module.exports [as verify] (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/verify.js:97:12)\n' +
    '    at Object.decode (webpack-internal:///(sc_server)/./lib/session.ts:32:86)\n' +
    '    at Object.session (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/core/routes/session.js:25:44)\n' +
    '    at AuthHandler (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/core/index.js:161:50)\n' +
    '    at async getServerSession (webpack-internal:///(sc_server)/./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next-auth/next/index.js:129:21)\n' +
    '    at async getCurrentUser (webpack-internal:///(sc_server)/./lib/session.ts:76:21)\n' +
    '    at async Navbar (webpack-internal:///(sc_server)/./components/Navbar.tsx:25:21)',
  name: 'JsonWebTokenError'
}

Any help would be greatly appreciate it. Thanks.

Grafbase deployment and project creation error

Hello, I am following the video on Youtube up to the 3:00:00 mark and trying to deploy the grafbase project, but the deployment fails and I am getting this error "Environment variable NEXTAUTH_SECRET is not set" even though I created the root .env and the .env in the grafbase directory. Both of them have the NEXTAUTH_SECRET.

image

I have this in my grafbase.config.ts
image

I am also unable to create projects. When submitting projects I get this error:

Error: GraphQL Error (Code: 200): {"response":{"error":"{\"data\":null,\"errors\":[{\"message\":\"Unauthorized\"}]}","status":200,"headers":{"map":{"content-length":"51","content-type":"text/xml"}}},"request":{"query":"\n\tmutation CreateProject($input: ProjectCreateInput!) {\n\t\tprojectCreate(input: $input) {\n\t\t\tproject {\n\t\t\t\tid\n\t\t\t\ttitle\n\t\t\t\tdescription\n\t\t\t\tcreatedBy {\n\t\t\t\t\temail\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n","variables":{"input":{"title":"test","description":"test","image":"http://res.cloudinary.com/dkjbqkxbt/image/upload/v1692362385/jbvoynflj2tiufgfdnpr.png","liveSiteUrl":"https://github.com/adrianhajdin/project_nextjs13_flexibble","githubUrl":"https://github.com/adrianhajdin/project_nextjs13_flexibble","category":"Full-Stack","createdBy":{"link":"user_01H63XPMGTE1D8GVN3TDC5WZKN"}}}}}
    at makeRequest (webpack-internal:///(app-pages-browser)/./node_modules/graphql-request/build/esm/index.js:301:15)
    at async makeGraphQLRequest (webpack-internal:///(app-pages-browser)/./lib/actions.ts:23:16)
    at async handleFormSubmit (webpack-internal:///(app-pages-browser)/./components/ProjectForm.tsx:36:17)

Any assistance is greatly appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.