-
Notifications
You must be signed in to change notification settings - Fork 71
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
There has been an error with the Apple News API: INVALID_DOCUMENT - (null or null (JSON) or Property was not an array (JSON)) (keyPath metadata->authors) #1156
Comments
The issue is that apple-news/includes/apple-exporter/builders/class-metadata.php Lines 48 to 59 in 29fd125
I assume you're on the latest available version of the plugin (the 2.5 branch, so 2.5.0 or 2.5.1)? If so, the only explanation that makes sense is that another plugin, or your theme, or custom code you have running on your site, is filtering the output of either the Apple News metadata or the JSON for the entire article and is replacing this value with an invalid one. |
Thanks for your quick reply. Yes, it's not Apple News per se, as I initially thought. |
Ok, I did a series of tests. Here's what I've found so far: The code snipped you referenced is indeed returning an array. So I started checking layer by layer, and I ended up here, where I think everything starts: apple-news/includes/apple-exporter/class-workspace.php Lines 143 to 157 in 29fd125
After debugging the variables, this is what I've got:
So, I don't know, but this isn't being filtered after. This is being stored in database that way. Maybe this is being filtered before? Any ideas? Well, I also found 3 different plugins that might be causing it: I looked for any plugins that uses the apply_filters for get_post_metadata and found:
The first two, I don't think they're the cause because of the use case of the applied filters. BUT, the Wordfence plugin has an option enabled: "Prevent discovery of usernames through '/?author=N' scans, the oEmbed API, the WordPress REST API, and WordPress XML Sitemaps" Is it possible that Wordfence is preventing Apple News to generate the JSON data? Do you know if it uses the REST API? |
That's a good theory - if you're using the block editor (Gutenberg) to edit content, then Apple News does indeed use the REST API to get and set its own metadata when editing content. I'll have to dig into this further to figure out why this is an issue. As a test, could you disable WordFence and try on a new article and see if there's any change? That would at least tell you if that plugin is the source of the trouble. |
Description of the bug
Hello,
I'm dropping this question here because I haven't seen any similar issues in this forum.
Whenever one publishes a post (and as far as I could test, this is only for a particular post type - Micropost), we got the error: "There has been an error with the Apple News API: INVALID_DOCUMENT - (null or null (JSON) or Property was not an array (JSON)) (keyPath metadata->authors)"
I already checked if the authors are set for this post type, and they are, so I have no idea why this is happening. I'm hoping to have some guidance here.
Here's the code from the "debug" option for the try (I see the authors coming as "1", but have no idea how to fix it):
Thanks in advance.
Steps To Reproduce
Additional Information
When you try to manually "Publish" it, the same error occurs.
The text was updated successfully, but these errors were encountered: