I have enabled JSONAPI on my site and when creating content that has an Image field on it via Media, I get this error:

"POST /node/add/article?ajax_form=1&_wrapper_format=drupal_ajax HTTP/1.1" 500
Uncaught PHP Exception InvalidArgumentException: "The URI '/sites/default/files/anner%20%281%29.jpg' is invalid. You must use a valid URI scheme." at /mnt/www/html/vkajnwtoai/docroot/core/lib/Drupal/Core/Url.php line 280 request_id="v-b3d39744-1a0d-11e7-9f10-22000b5e357e"

If I uninstall jsonapi the error goes away

Core: 8.2.6

The following Media modules are enabled:
Media Entity Browser (entity_browser) Module Enabled
Media File entity (file_entity) Module Enabled
Media Image Effects (image_effects) Module Enabled
Media Media entity (media_entity) Module Enabled
Media Media entity document (media_entity_document) Module Enabled
Media Media entity image (media_entity_image) Module Enabled
Media Media entity Instagram (media_entity_instagram) Module Enabled
Media Media entity Twitter (media_entity_twitter) Module Enabled
Media Media entity video (media_entity_video) Module Enabled
Video Embed Field Video Embed Media (video_embed_media) Module Enabled
Field types Image (image) Module Enabled 8.2.6

CommentFileSizeAuthor
#7 2867106--unrenderable-uri--7.patch1.2 KBe0ipso

Comments

meba created an issue. See original summary.

meba’s picture

Here is another way of triggering the issue: Once you have some entity with a file attached go to example.com/file/[fid] - you will see the same error

wim leers’s picture

Can you also reproduce this with the core REST module?

e0ipso’s picture

Issue tags: +RC blocker

Blocking RC on this bug.

meba’s picture

@Wim I cannot reproduce this with core REST. I used core REST on the same site and everything worked.

  • e0ipso committed 72be762 on 8.x-1.x
    fix(Images): Turn download path into a text field type (#2867106 by...
e0ipso’s picture

Status: Active » Fixed
StatusFileSize
new1.2 KB

This is the patch that fixed the issue. It turns out that t he hostname agnostic path introduced in https://www.drupal.org/node/2793809#comment-11592483 was never renderable as a URI.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.