-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Media uploads fail with error message "input must not start with a slash when using prefixUrl" #343
Comments
Interesting. Can you share the config file you are using? That might give some clues to what’s going on. I think you might be on the right track… perhaps
If you could share your endpoint URL too, that might help as well. |
Certainly I can. This is the contents of my config file at present: import {Indiekit} from '@indiekit/indiekit';
import {HugoPreset} from './hugo-preset/index.js';
import {GithubStore} from '@indiekit/store-github';
// Create a new indiekit instance
const indiekit = new Indiekit();
// Configure GitHub content store
const github = new GithubStore({
user: process.env.GITHUB_USER, // GitHub username
repo: process.env.GITHUB_REPO, // repo to write to
branch: process.env.GITHUB_BRANCH, // branch of that repo
token: process.env.GITHUB_TOKEN // access token
});
// Will this work? Fingers crossed.
const hugo = new HugoPreset({});
// Configure post types
const postTypes = [{
type: 'article',
name: 'Article',
post: {
path: 'content/posts/{yyyy}/{MM}/{slug}.md',
url: '{yyyy}/{MM}/{slug}.html'
},
media: {
path: 'static/images/{yyyy}/{MM}/{filename}',
url: 'images/{yyyy}/{MM}/{filename}'
}
}, {
type: 'note',
name: 'Note',
post: {
path: 'content/posts/{yyyy}/{MM}/{slug}.md',
url: '{yyyy}/{MM}/{slug}.html'
}
}, {
type: 'photo',
name: 'Photo',
post: {
path: 'content/posts/{yyyy}/{MM}/{slug}/index.md',
url: '{yyyy}/{MM}/{slug}.html'
},
media: {
path: 'content/posts/{yyyy}/{MM}/{slug}/{filename}',
url: '{yyyy}/{MM}/{slug}/{filename}'
}
}, {
type: 'bookmark',
name: 'Bookmark',
post: {
path: 'content/interactions/{yyyy}/{MM}/{slug}.md',
url: '{yyyy}/{MM}/{slug}.html'
}
}, {
type: 'like',
name: 'Like',
post: {
path: 'content/interactions/{yyyy}/{MM}/{slug}.md',
url: '{yyyy}/{MM}/{slug}.html'
}
}, {
type: 'reply',
name: 'Reply',
post: {
path: 'content/interactions/{yyyy}/{MM}/{slug}.md',
url: '{yyyy}/{MM}/{slug}.html'
}
}];
// Define post categories (not tags)
indiekit.set('publication.categories', ["Articles","Books","Film and TV","Food","Games","Internet","Languages","Life","News and Politics","Pets","Photos","Site Updates","Technology","Transport","Writing"]);
// Configure publication
indiekit.set('publication.me', process.env.PUBLICATION_URL); // what will be the site's homepage
indiekit.set('publication.timeZone', 'Australia/Melbourne');
indiekit.set('publication.preset', hugo);
indiekit.set('publication.postTypes', postTypes);
indiekit.set('publication.store', github);
// Create a MongoDB database to be able to edit/delete old posts
// indiekit.set('application.mongodbUrl', process.env.MONGODB_URL);
// Create a server
const server = indiekit.server();
// Export server
export default server; And the URL of my Indiekit endpoint is https://jls-indiekit.herokuapp.com/ – the media endpoint should just be the built-in one. Thanks for looking into this! |
Sorry, another question; what client(s) are you using to post to your micropub endpoint with? Want to try and simulate what you are seeing, if I can. Thanks! |
Actually, I can see this same result. I think it’s related to me removing a part of the codebase which created a fully resolved URL for the local media endpoint: 3025aa7 |
Just released v0.1.1 with what hopefully amounts to a fix. Let me know if you run into any issues. Also… I’d be very keen to learn how you are using Hugo, and how Indiekit could potentially improve its support. |
Thank you, that seems to be working now! And sure – I didn't want to flood you with loads of issues at once, but there are definitely a few Hugo-specific issues I've run into that I'd be happy to report. |
Hello! I've recently set up Indiekit 0.1.0 on Heroku, and while other types of posts are getting written to my testing repository just fine, photo posts are all consistently failing. I get an extremely long 500 internal server error, which gives me the HTML source code of the endpoint layout with the following error message in it:
(I'm providing only that cos I think it's the only relevant part, but if you want any more of the output let me know.) I went and Googled that error and found it comes from this line of the "got" dependency.
I did a bit more digging and found that I could upload successfully through the built-in media endpoint using a tool like Micro-Media-Endpoint-Proxy that bypasses the "posting a post with your media" step. So, the problem seemed to be with the hand-off from the main endpoint to the media one, rather than a problem with the media endpoint itself.
I checked what happens in the Heroku console when I attempt to post a proper photo post, and can see that it gives me this:
Unfortunately I'm a lot better at googling than I am at programming myself, and my attempts at working around the issue on my own endpoint have all failed miserably. (As in, I tried dropping the forward slash from mediaEndpoint's mountpath, and that changed nothing.) I was hoping that whenever you had some time, you could take a look and see how the problem could be fixed. Thank you very much – overall I'm really appreciative of how modular and useful Indiekit is!
The text was updated successfully, but these errors were encountered: