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

Dereferencing a URL did not result in a valid JSON-LD object #747

Open
pyrog opened this issue Dec 16, 2020 · 5 comments
Open

Dereferencing a URL did not result in a valid JSON-LD object #747

pyrog opened this issue Dec 16, 2020 · 5 comments

Comments

@pyrog
Copy link

pyrog commented Dec 16, 2020

All remote documents used display the following error:

jsonld.InvalidUrl: Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.

Example : https://mobilizon.chapril.org/events/ed969ea7-5c89-460e-b87b-6411ce747965

All tabs are empty, except the Visualized tab that display the graph.
Expanded tab Vusalized tab

Tested with Safari, Chrome and Firefox

@pyrog
Copy link
Author

pyrog commented Dec 16, 2020

Another example with data past from a webpage: same error message.

{

	"@context"				: "http://schema.org",
	"@type"					: "FoodEstablishment",
	
	"image": [
		
		"https://cdn.website.dish.co/media/62/04/2322328/Au-Cha-LHeureux-couv-cha.jpg"
	],
	
	"name"					: "Au Cha L'Heureux",
	"address"				: {
		"@type": "PostalAddress",
		"streetAddress": "3 Impasse du Miracle",
		"addressLocality": "Chavanod",
		"postalCode": "74650",
		"addressCountry": "FR"
	},
	"email"					: "",
	
	"menu"				: "https://cdn.website.dish.co/media/d5/b1/2385750/Au-Cha-LHeureux-menu-cha-lheureux.jpg",
	
	"priceRange": "",
	
	"geo"					: {
		"@context"				: "http://schema.org",
		"@type"					: "GeoCoordinates",
		"latitude"				: "45.8833524",
		"longitude"				: "6.0622454"
	},
	"url"					: "https://au-cha-lheureux-restaurant.eatbu.com/",
	"telephone"				: "+33450524233",
	"servesCuisine"			: "Française, Fait maison, Traditionnel",
	"paymentAccepted"		: "Espèces, Paiement sans contact, MasterCard, Ticket Restaurant®, VISA, Carte ticket restaurant, Carte de débit, Apple Pay",
	
	"openingHoursSpecification" : [
			
			{
			    "@type"		: "OpeningHoursSpecification",
			    "dayOfWeek"	: "http://schema.org/Monday",
			    "opens"		: "12:00",
			    "closes"	: "14:00"
			}
			,
		
			{
			    "@type"		: "OpeningHoursSpecification",
			    "dayOfWeek"	: "http://schema.org/Tuesday",
			    "opens"		: "12:00",
			    "closes"	: "14:00"
			}
			,
		
			{
			    "@type"		: "OpeningHoursSpecification",
			    "dayOfWeek"	: "http://schema.org/Wednesday",
			    "opens"		: "12:00",
			    "closes"	: "14:00"
			}
			,
		
			{
			    "@type"		: "OpeningHoursSpecification",
			    "dayOfWeek"	: "http://schema.org/Thursday",
			    "opens"		: "12:00",
			    "closes"	: "14:00"
			}
			,
			{
			    "@type"		: "OpeningHoursSpecification",
			    "dayOfWeek"	: "http://schema.org/Thursday",
			    "opens"		: "18:00",
			    "closes"	: "21:00"
			}
			,
		
			{
			    "@type"		: "OpeningHoursSpecification",
			    "dayOfWeek"	: "http://schema.org/Friday",
			    "opens"		: "12:00",
			    "closes"	: "14:00"
			}
			,
			{
			    "@type"		: "OpeningHoursSpecification",
			    "dayOfWeek"	: "http://schema.org/Friday",
			    "opens"		: "18:00",
			    "closes"	: "21:00"
			}
			,
		
			{
			    "@type"		: "OpeningHoursSpecification",
			    "dayOfWeek"	: "http://schema.org/Saturday",
			    "opens"		: "12:00",
			    "closes"	: "14:00"
			}
			,
			{
			    "@type"		: "OpeningHoursSpecification",
			    "dayOfWeek"	: "http://schema.org/Saturday",
			    "opens"		: "18:00",
			    "closes"	: "21:00"
			}
			,
		
			{
			    "@type"		: "OpeningHoursSpecification",
			    "dayOfWeek"	: "http://schema.org/Sunday",
			    "opens"		: "00:00",
			    "closes"	: "00:00"
			}
	
	],
	"specialOpeningHoursSpecification" : [
		
	]
		
	,"deliveryMethod": [
		
		"PICKUP",
		"DELIVERY"    	]
	
}

@gkellogg
Copy link
Member

It works with the Ruby distiller: http://rdf.greggkellogg.net/distiller?command=expand&format=jsonld&output_format=jsonld&url=https:%2F%2Fmobilizon.chapril.org%2Fevents%2Fed969ea7-5c89-460e-b87b-6411ce747965

as the error message indicated, it seems to most likely be a CORS issue.

@luzlozanothermo
Copy link

if you fix this issue of CORS error, please post it, i'm struggling with the same

@gkellogg
Copy link
Member

It's a server configuration issue. These are the headers returned from schema.org:

HTTP/2 200 
access-control-allow-credentials: true
access-control-allow-headers: Accept
access-control-allow-methods: GET
access-control-allow-origin: *
date: Fri, 19 Feb 2021 01:39:59 GMT
expires: Fri, 19 Feb 2021 01:49:59 GMT
etag: "v7F5aA"
x-cloud-trace-context: f8ad172246c779315ef4433df90888c6
content-type: application/ld+json
server: Google Frontend
content-length: 156492
cache-control: public, max-age=600
age: 0
alt-svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=

Key is probably access-control-allow-origin: *.

CORS was a bad idea, IMHO.

@gkellogg
Copy link
Member

@davidlehn thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants