Next.js Discord

Discord Forum

TypeError: getStaticPaths is not a function

Unanswered
Pigeon tremex posted this in #help-forum
Open in Discord
Pigeon tremexOP
    const getFamilyData = async () => {
        try {
            const res: any = await fetchFamilyMembers();
            if (res?.status === 200) {
                setFamilyMembers(res?.data);
            }
        }
        catch (err) {
            console.log(err)
        }
    }

  export const fetchFamilyMembers = async () => {
    try {
        const res = await fetch(process.env.NEXT_PUBLIC_BASE_URL + endpoints.addFamily)
        if(res?.status === 200){
            return res
        }
        return {data: []}
    } catch (error:any) {
        if(error?.response)
        return error?.response
        return error
    }
}


If I comment the fetch request then it works perfectly. The thing here is that getFamilyData function is not even being called but I still get the error mentioned above.

0 Replies