Home > Back-end >  TypeError: Cannot read properties of undefined (reading 'post')
TypeError: Cannot read properties of undefined (reading 'post')

Time:10-23

So I'm doing a tutorial on Skillshare for building a microblog. As part of the github login he instructed to build a function that has a axios post. and whenever i call this route it gives me an error "TypeError: Cannot read properties of undefined (reading 'post')" at line 12, which is the below variable. I cant seem to figure out what's wrong. any idea why its giving me this error?

const githubAuthResult = await axios.post(
    `https://github.com/login/oauth/access_token?client_id=${environment.clientId}&client_secret=${environment.clientSecret}&code=${code}`,
    null,
    { headers: { Accept: 'application.json' } }
  );

yes i have the axios and the environment variables import

import axios from 'axios';
import { environment } from '../../environments/environment';

The full code of the route if needed can be found here

CodePudding user response:

It seems your axios version: 1.1.3 has some issues Downgrading to 1.1.0 should help you move on

  • Related