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

[Bug]: HttpError: Not Found - https://docs.github.com/rest/repos/contents#create-or-update-file-contents #371

Open
2 tasks done
williamium3000 opened this issue Dec 15, 2024 · 10 comments
Assignees
Labels
❓ Question Further information is requested 🔁 No reproduction Where I can't repro the bug

Comments

@williamium3000
Copy link

Issue validation

  • I checked the issue to prevent duplicate
  • I checked my configurations files and the documentation

Command used

No response

Plugin version

1.0.0

Describe the bug

This is the test md file in obsidian:

---
date: "{{date}}"
tags:
  - tag1
  - tag2
title: "{{title}}"
slug: "{{time}}"
share: true
canonicalURL: 
keywords: 
description: 
series: series1
lastmod: 
lang: en
cover.image: 
author: william
dir: content/post
---
this is a hello world page

I have set up all the github related configurations and test connection works fine.

But I encounter the following error:

HttpError: Not Found - https://docs.github.com/rest/repos/contents#create-or-update-file-contents

And the file is not uploaded to my GitHub either.
My GitHub is publically available.
https://github.com/williamium3000/myblog

How to reproduce ?

No response

Minimal Reproducible Example

---
date: "{{date}}"
tags:
  - tag1
  - tag2
title: "{{title}}"
slug: "{{time}}"
share: true
canonicalURL: 
keywords: 
description: 
series: series1
lastmod: 
lang: en
cover.image: 
author: william
dir: content/post
---
this is a hello world page

Configuration

{
  "github": {
    "branch": "main",
    "automaticallyMergePR": true,
    "dryRun": {
      "enable": false,
      "folderName": "github-publisher"
    },
    "tokenPath": "%configDir%/plugins/%pluginID%/env",
    "api": {
      "tiersForApi": "Github Free/Pro/Team (default)",
      "hostname": ""
    },
    "workflow": {
      "commitMessage": "[PUBLISHER] Merge",
      "name": ""
    },
    "verifiedRepo": true
  },
  "upload": {
    "behavior": "yaml",
    "defaultName": "content/post",
    "rootFolder": "content",
    "yamlFolderKey": "dir",
    "frontmatterTitle": {
      "enable": false,
      "key": "title"
    },
    "replaceTitle": [],
    "replacePath": [],
    "autoclean": {
      "enable": false,
      "excluded": []
    },
    "folderNote": {
      "enable": false,
      "rename": "index.md",
      "addTitle": {
        "enable": false,
        "key": "title"
      }
    },
    "metadataExtractorPath": ""
  },
  "conversion": {
    "hardbreak": true,
    "dataview": true,
    "censorText": [
      {
        "entry": "/\\]\\(([^)\\.]+)\\.md/",
        "replace": "]({{< relref \"$1.md\" >}}",
        "flags": "",
        "after": true,
        "inCodeBlocks": false
      },
      {
        "entry": "/cover\\.image/",
        "replace": "cover:\\n    image",
        "flags": "",
        "after": false
      },
      {
        "entry": "/\\]\\(([^/\\)]+?)\\.(png|jpg|jpeg|webp|gif)/",
        "replace": "](/images/$1.$2",
        "flags": "",
        "after": true
      },
      {
        "entry": "/\\!\\[\\[([^/\\]]+?)\\.(png|jpg|jpeg|webp|gif)\\|(\\d+)(x(\\d+))?\\]\\]/",
        "replace": "{{< figure src=\"/images/$1.$2\"  width=\"$3\" height=\"$5\">}}",
        "flags": "",
        "after": false
      },
      {
        "entry": "/\\!\\[\\[([^/\\]]+?)\\.(png|jpg|jpeg|webp|gif)\\|([^\\|]*?)(\\|(\\d+)(x(\\d+))?)?\\]\\]/",
        "replace": "{{< figure src=\"/images/$1.$2\" caption=\"$3\" width=\"$5\" height=\"$7\">}}",
        "flags": "",
        "after": false
      }
    ],
    "tags": {
      "inline": true,
      "exclude": [],
      "fields": []
    },
    "links": {
      "internal": false,
      "unshared": false,
      "wiki": true,
      "slugify": "lower"
    }
  },
  "embed": {
    "attachments": true,
    "overrideAttachments": [],
    "keySendFile": [],
    "notes": false,
    "folder": "static/images",
    "convertEmbedToLinks": "keep",
    "charConvert": "->",
    "forcePushAttachments": [],
    "useObsidianFolder": false
  },
  "plugin": {
    "shareKey": "share",
    "excludedFolder": [],
    "copyLink": {
      "enable": false,
      "links": "",
      "removePart": [],
      "transform": {
        "toUri": true,
        "slugify": "lower",
        "applyRegex": []
      }
    },
    "setFrontmatterKey": "Set"
  },
  "tabsId": "github-configuration"
}

Relevant log output

HttpError: Not Found - https://docs.github.com/rest/repos/contents#create-or-update-file-contents

OS

No response

Anything else?

No response

Obsidian information

SYSTEM INFO:
	Obsidian version: v1.7.7
	Installer version: v1.7.7
	Operating system: Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:15 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6000 24.1.0
	Login status: logged in
	Language: en
	Catalyst license: none
	Insider build toggle: off
	Live preview: on
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 0
	Restricted mode: off
	Plugins installed: 19
	Plugins enabled: 19
		1: Excalidraw v2.6.8
		2: Dataview v0.5.67
		3: Advanced Tables v0.22.1
		4: Templater v2.9.1
		5: Iconize v2.14.6
		6: Outliner v4.8.1
		7: Omnisearch v1.25.1
		8: Linter v1.27.1
		9: Importer v1.6.13
		10: Text Generator v0.7.43
		11: Pandoc Plugin v0.4.1
		12: Copilot v2.7.7
		13: Paste URL into selection v1.7.0
		14: ZotLit v1.1.9
		15: Image Toolkit v1.4.2
		16: Copy document as HTML v0.8.1
		17: Image auto upload v4.1.0
		18: Enveloppe v7.4.0
		19: Image Inserter v0.7.0

RECOMMENDATIONS:
	Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.
@williamium3000 williamium3000 added the 🐛 Bug Something isn't working label Dec 15, 2024
@Mara-Li
Copy link
Member

Mara-Li commented Dec 15, 2024

What did you set in the configuration for the repository?

Is the github repo in public or private?

@williamium3000
Copy link
Author

williamium3000 commented Dec 17, 2024

I did not set any configuration for the github repo. It's a public repo.
Here is the URL for the repo https://github.com/williamium3000/myblog

I have followed the docs to set up the github configuration in the plugin, including the github token etc.
But I encounter the above error. I have attached my test obsidian note and the configuration used above.

@Mara-Li
Copy link
Member

Mara-Li commented Dec 17, 2024

Bruh.
Not the first time this happend. Github api is not reliable.
Will check that when I have the time

@Mara-Li
Copy link
Member

Mara-Li commented Dec 17, 2024

By any chance, did you have protected the main branch ?
At wish step the error appear ?
I noticed that reproducing this kind of bug is difficult, so, if possible, I need your entire log.

@Mara-Li Mara-Li added ❓ Question Further information is requested 🔁 No reproduction Where I can't repro the bug and removed 🐛 Bug Something isn't working labels Dec 17, 2024
@williamium3000
Copy link
Author

I don't think it's protected
Image

How can I provide you with the entire log?

It happens after I use the cmd+p and then Enveloppe: upload single current active note. Then it reports the error.
Image

Despite it says success after the error. I check my github and the note is not uploaded.

@Mara-Li
Copy link
Member

Mara-Li commented Dec 17, 2024

Strange.
Normally, there should be a "normal" 404 error (as the file not exist) but the file should be created.
I forked and used your settings, and I don't have any error. I even recreated a default token and didn't have any problem.

Can you please open the log console (CTRL+Maj+I) and copy paste everything?
Which command did you use?

@Mara-Li
Copy link
Member

Mara-Li commented Dec 17, 2024

For branch protection: Image

@williamium3000
Copy link
Author

Yeah it's not protected.
Image

@williamium3000
Copy link
Author

Strange. Normally, there should be a "normal" 404 error (as the file not exist) but the file should be created. I forked and used your settings, and I don't have any error. I even recreated a default token and didn't have any problem.

Can you please open the log console (CTRL+Maj+I) and copy paste everything? Which command did you use?

If it works on the forked repo, maybe there is some error with mu configuration?

@williamium3000
Copy link
Author

logs from the log console.

pulls:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
plugin:obsidian-mkdocs-publisher:183 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'join')
    at eval (plugin:obsidian-mkdocs-publisher:183:40710)
    at e.addTextArea (app.js:1:1402645)
    at EnveloppeSettingsTab.renderEmbedConfiguration (plugin:obsidian-mkdocs-publisher:183:40616)
    at EnveloppeSettingsTab.renderSettingsPage (plugin:obsidian-mkdocs-publisher:183:18420)
    at async HTMLDivElement.eval (plugin:obsidian-mkdocs-publisher:183:17842)
refs:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
plugin:obsidian-mkdocs-publisher:202 2024-12-15 14:23:33.467	INFO		Enveloppe	Branch already exists (notes-12-15-2024 on williamium3000/myblog - Using it.
content%2Fpost%2Fhello.md:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
content%2Fpost%2Fhello.md:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
plugin:obsidian-mkdocs-publisher:202 2024-12-15 14:23:33.801	FATAL		Enveloppe	
 HttpError  Not Found - https://docs.github.com/rest/repos/contents#create-or-update-file-contents, HttpError, 404, [object Object], [object Object]
error stack:
  • 	
	
  • 	
	
  • 	
	
  • 	
	
  • 	
	
  • 	
	
pulls:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
plugin:obsidian-mkdocs-publisher:183 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'join')
    at eval (plugin:obsidian-mkdocs-publisher:183:40710)
    at e.addTextArea (app.js:1:1402645)
    at EnveloppeSettingsTab.renderEmbedConfiguration (plugin:obsidian-mkdocs-publisher:183:40616)
    at EnveloppeSettingsTab.renderSettingsPage (plugin:obsidian-mkdocs-publisher:183:18420)
    at async HTMLDivElement.eval (plugin:obsidian-mkdocs-publisher:183:17842)
refs:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
plugin:obsidian-mkdocs-publisher:202 2024-12-17 11:28:17.749	INFO		Enveloppe	Branch already exists (notes-12-15-2024 on williamium3000/myblog - Using it.
content%2Fpost%2Fhello.md:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
content%2Fpost%2Fhello.md:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
plugin:obsidian-mkdocs-publisher:202 2024-12-17 11:28:18.255	FATAL		Enveloppe	
 HttpError  Not Found - https://docs.github.com/rest/repos/contents#create-or-update-file-contents, HttpError, 404, [object Object], [object Object]
error stack:
  • 	
	
  • 	
	
  • 	
	
  • 	
	
  • 	
	
  • 	
	
pulls:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
refs:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
plugin:obsidian-mkdocs-publisher:202 2024-12-17 11:28:28.949	INFO		Enveloppe	Branch already exists (notes-12-15-2024 on williamium3000/myblog - Using it.
content%2Fpost%2Fhello.md:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
content%2Fpost%2Fhello.md:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
plugin:obsidian-mkdocs-publisher:202 2024-12-17 11:28:29.140	FATAL		Enveloppe	
 HttpError  Not Found - https://docs.github.com/rest/repos/contents#create-or-update-file-contents, HttpError, 404, [object Object], [object Object]
error stack:
  • 	
	
  • 	
	
  • 	
	
  • 	
	
  • 	
	
  • 	
	
pulls:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
refs:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
plugin:obsidian-mkdocs-publisher:202 2024-12-17 11:28:39.344	INFO		Enveloppe	Branch already exists (notes-12-15-2024 on williamium3000/myblog - Using it.
content%2Fpost%2Fhello.md:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
content%2Fpost%2Fhello.md:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
plugin:obsidian-mkdocs-publisher:202 2024-12-17 11:28:39.551	FATAL		Enveloppe	
 HttpError  Not Found - https://docs.github.com/rest/repos/contents#create-or-update-file-contents, HttpError, 404, [object Object], [object Object]
error stack:
  • 	
	
  • 	
	
  • 	
	
  • 	
	
  • 	
	
  • 	
	
pulls:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
refs:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
plugin:obsidian-mkdocs-publisher:202 2024-12-17 11:28:55.095	INFO		Enveloppe	Branch already exists (notes-12-15-2024 on williamium3000/myblog - Using it.
content%2Fpost%2Fhello.md:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
content%2Fpost%2Fhello.md:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
plugin:obsidian-mkdocs-publisher:202 2024-12-17 11:28:55.391	FATAL		Enveloppe	
 HttpError  Not Found - https://docs.github.com/rest/repos/contents#create-or-update-file-contents, HttpError, 404, [object Object], [object Object]
error stack:
  • 	
	
  • 	
	
  • 	
	
  • 	
	
  • 	
	
  • 	
	
pulls:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
plugin:obsidian-mkdocs-publisher:22 
        
        
       POST https://api.github.com/repos/williamium3000/myblog/git/refs 404 (Not Found)
fetchWrapper @ plugin:obsidian-mkdocs-publisher:22
request2 @ plugin:obsidian-mkdocs-publisher:22
eval @ plugin:obsidian-mkdocs-publisher:22
Promise.then
register @ plugin:obsidian-mkdocs-publisher:22
Object.assign.endpoint @ plugin:obsidian-mkdocs-publisher:22
newBranchOnRepo @ plugin:obsidian-mkdocs-publisher:42
await in newBranchOnRepo
newBranch @ plugin:obsidian-mkdocs-publisher:42
shareOneNote @ plugin:obsidian-mkdocs-publisher:27
await in shareOneNote
checkCallback @ plugin:obsidian-mkdocs-publisher:27
ZU @ app.js:1
t.onChooseItem @ app.js:1
t.onChooseSuggestion @ app.js:1
t.selectSuggestion @ app.js:1
e.useSelectedItem @ app.js:1
(anonymous) @ app.js:1
e.handleKey @ app.js:1
e.onKeyEvent @ app.js:1
plugin:obsidian-mkdocs-publisher:202 2024-12-17 22:52:15.915	INFO		Enveloppe	Branch already exists (notes-12-15-2024 on williamium3000/myblog - Using it.
plugin:obsidian-mkdocs-publisher:22 
        
        
       GET https://api.github.com/repos/williamium3000/myblog/contents/content%2Fpost%2Fhello.md?ref=notes-12-15-2024 404 (Not Found)
fetchWrapper @ plugin:obsidian-mkdocs-publisher:22
request2 @ plugin:obsidian-mkdocs-publisher:22
eval @ plugin:obsidian-mkdocs-publisher:22
Promise.then
register @ plugin:obsidian-mkdocs-publisher:22
Object.assign.endpoint @ plugin:obsidian-mkdocs-publisher:22
upload @ plugin:obsidian-mkdocs-publisher:42
uploadText @ plugin:obsidian-mkdocs-publisher:42
uploadOnMultipleRepo @ plugin:obsidian-mkdocs-publisher:42
await in uploadOnMultipleRepo
publish @ plugin:obsidian-mkdocs-publisher:42
await in publish
shareOneNote @ plugin:obsidian-mkdocs-publisher:27
await in shareOneNote
checkCallback @ plugin:obsidian-mkdocs-publisher:27
ZU @ app.js:1
t.onChooseItem @ app.js:1
t.onChooseSuggestion @ app.js:1
t.selectSuggestion @ app.js:1
e.useSelectedItem @ app.js:1
(anonymous) @ app.js:1
e.handleKey @ app.js:1
e.onKeyEvent @ app.js:1
plugin:obsidian-mkdocs-publisher:22 
        
        
       PUT https://api.github.com/repos/williamium3000/myblog/contents/content%2Fpost%2Fhello.md 404 (Not Found)
fetchWrapper @ plugin:obsidian-mkdocs-publisher:22
request2 @ plugin:obsidian-mkdocs-publisher:22
eval @ plugin:obsidian-mkdocs-publisher:22
Promise.then
register @ plugin:obsidian-mkdocs-publisher:22
Object.assign.endpoint @ plugin:obsidian-mkdocs-publisher:22
upload @ plugin:obsidian-mkdocs-publisher:42
await in upload
uploadText @ plugin:obsidian-mkdocs-publisher:42
uploadOnMultipleRepo @ plugin:obsidian-mkdocs-publisher:42
await in uploadOnMultipleRepo
publish @ plugin:obsidian-mkdocs-publisher:42
await in publish
shareOneNote @ plugin:obsidian-mkdocs-publisher:27
await in shareOneNote
checkCallback @ plugin:obsidian-mkdocs-publisher:27
ZU @ app.js:1
t.onChooseItem @ app.js:1
t.onChooseSuggestion @ app.js:1
t.selectSuggestion @ app.js:1
e.useSelectedItem @ app.js:1
(anonymous) @ app.js:1
e.handleKey @ app.js:1
e.onKeyEvent @ app.js:1
plugin:obsidian-mkdocs-publisher:202 2024-12-17 22:52:16.567	FATAL		Enveloppe	
 HttpError  Not Found - https://docs.github.com/rest/repos/contents#create-or-update-file-contents, HttpError, 404, [object Object], [object Object]
error stack:
  • 	
	
  • 	
	
  • 	
	
  • 	
	
  • 	
	
  • 	
	
plugin:obsidian-mkdocs-publisher:22 
        
        
       POST https://api.github.com/repos/williamium3000/myblog/pulls 404 (Not Found)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ Question Further information is requested 🔁 No reproduction Where I can't repro the bug
Projects
None yet
Development

No branches or pull requests

2 participants