Creating A New Tree Errors With Not Found

I’m using Octokit to create a new tree but it’s failing with Not Found.

It doesn’t like the “get latest commit” request.

I feel like this is an XY problem. My original problem was with the newTree request, and since I narrowed the error down to the ``base_tree` being incorrect, I am now trying a different way to create a new tree based off the latest commit.

Anyway, here’s the code:

// NOTE: This is in an asynchronous function! The 'await's are not the issue.

let last_commit_tree = await this.octokit.request("GET /repos/{owner}/{repo}/branches/{branch}", {
	owner: this.owner, // valid string
	repo: this.repo, // valid string
	branch: `heads/${branch}` // branch is a valid string
});

let last_commit_sha = last_commit_tree.data.commit.sha;

let newTree = await this.octokit.request('POST /repos/{owner}/{repo}/git/trees', {
	owner: this.name, // valid string
	repo: this.repo, // valid string
	tree: [{ path: "test.txt", type: "blob", mode: "100644", content: "hello this is a git API test" }],
	base_tree: last_commit_sha
});