Skip to content

Commit ccc228f

Browse files
authored
Merge pull request #10 from sh41/patch-1
Troubleshooting section
2 parents b5cfe10 + aa9681f commit ccc228f

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Reference the Bootstrap CSS stylesheet in `public/index.html` (optional):
4848

4949
In the app directory, generate the files for the resource you want:
5050

51-
$ api-platform-generate-crud http://localhost src/ --resource foo
51+
$ api-platform-generate-crud https://demo.api-platform.com src/ --resource foo
5252
# Replace the URL by the entrypoint of your Hydra-enabled API
5353
# Omit the resource flag to generate files for all resource types exposed by the API
5454

Troubleshooting.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
# Troubleshooting
3+
* The generator does not perform any authentication, so you must ensure that all referenced hydra paths for your API are accessible anonymously. If you are using [API Platform](https://api-platform.com) this will at least include:
4+
```
5+
api_entrypoint ANY ANY ANY /{index}.{_format}
6+
api_doc ANY ANY ANY /docs.{_format}
7+
api_jsonld_context ANY ANY ANY /contexts/{shortName}.{_format}
8+
```
9+
10+
* If you recieve `Error: The class http://www.w3.org/ns/hydra/core#ApiDocumentation doesn't exist.` you may have specified the documentation URL instead of the entrypoint. For example if you are using [API Platform](https://api-platform.com) and your documentation URL is at [https://demo.api-platform.com/docs] the entry point is likely at [https://demo.api-platform.com]. You can see an example of the expected response from an entrypoint in your browser by clicking visiting [https://demo.api-platform.com/index.jsonld].
11+
12+
* If you receive `TypeError: Cannot read property '@type' of undefined` or `TypeError: Cannot read property '0' of undefined` check that the URL you specified is accessible and returns jsonld. You can check from the command line you are using by running something like `curl https://demo.api-platform.com/`.
13+
14+
* If you receive a message like this:
15+
```
16+
{ Error
17+
at done (/usr/local/share/.config/yarn/global/node_modules/jsonld/js/jsonld.js:6851:19)
18+
at <anonymous>
19+
at process._tickCallback (internal/process/next_tick.js:188:7)
20+
name: 'jsonld.InvalidUrl',
21+
message: 'Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.',
22+
details:
23+
{ code: 'invalid remote context',
24+
url: 'https://demo.api-platform.com/contexts/Entrypoint',
25+
cause: null } }
26+
```
27+
28+
Check access to the specified url, in this case `https://demo.api-platform.com/contexts/Entrypoint`, use curl to check access and the response `curl https://demo.api-platform.com/contexts/Entrypoint`. In the above case an "Access Denied" message in JSON format was being returned.

0 commit comments

Comments
 (0)