aryehraber / statamic-fetch

Statamic v2 Addon — Access content directly as JSON using URL endpoints or via a simple tag.
MIT License
55 stars 8 forks source link

Basic call not working #71

Closed maryzhenghan closed 4 years ago

maryzhenghan commented 4 years ago

Hi,

Just curious if this add-on is still working. I tried with this URL as a GET request in Postman

http://localhost:3000/!/Fetch/pages

and am getting a 504.

aryehraber commented 4 years ago

Hi @maryzhenghan! Hmm the addon should still be working on latest Statamic V2, can you confirm the version you are running?

maryzhenghan commented 4 years ago

@aryehraber We're running 2.11.19!

Also tried it as a POST request, and to some other URLs like

http://localhost:3000/!/Fetch/collections/blog ... got a 504 each time, though our local server was up and running.

aryehraber commented 4 years ago

@maryzhenghan Ok thanks for confirming!

Can you check that Fetch is installed correctly via Statamic’s CP in the Addons list: /cp/configure/addons

If installed correctly, what do you see when you visit the Fetch endpoints (eg: blog collection) directly in the browser (not using Postman)?

maryzhenghan commented 4 years ago

@aryehraber Confirmed that it's installed on the CP Addons list! I see Fetch v4.5, with a checkmark under the Installed column. Let me know if I should be looking for anything else.

As for visiting the endpoints directly, I'm seeing a Statamic error message:

Exception in StatamicController.php line 128: Method Statamic\Addons\Fetch\FetchController::getCollections() does not exist

I inherited this repo so apologies if I'm missing something pretty blatant right here.

aryehraber commented 4 years ago

@maryzhenghan Ah! I think that answers it, the current version is v4.10.1!

Would you mind downloading the latest version of Fetch on the Marketplace and trying again? Should literally be able to delete Fetch from the addons folder and replacing with the new Fetch addon folder.

maryzhenghan commented 4 years ago

@aryehraber Hi Aryeh, thanks for the tip. I updated but got the same message as the above:

Exception in StatamicController.php line 128: Method Statamic\Addons\Fetch\FetchController::getCollections() does not exist

aryehraber commented 4 years ago

Looking at the error more closely, I think the URL might be wrong, getCollections is not a method, it should be getCollection (without the s).

Can you try: /!/Fetch/collection/blog (removes the s from your earlier example).

maryzhenghan commented 4 years ago

@aryehraber Gotcha - I tried it and am now just getting a 504 Gateway Timeout.

aryehraber commented 4 years ago

Hmm ok, I’m honestly not sure at this point...

Are you able to share the project with me? Either by temporarily inviting me to the GH repo, or by sending a zip via email (excluding large folders like /assets, /node_modules, etc)? Also please remove and sensitive data if there is any!

maryzhenghan commented 4 years ago

@aryehraber would exporting a sample collection type (or all the collection types) be sufficient? The repo is pretty large so I'd love to just send what we need to over!

aryehraber commented 4 years ago

@maryzhenghan Yeah it's fine to strip the site down if it's large. However, I need a working site to be able to debug properly, I suggest you remove the following if possible:

It would be best to keep all content there, but if you feel you want to remove certain collections/pages that's fine. You can email me at aryeh.raber@gmail.com (let me know here on GH when you sent it so I know to look out for your email).

maryzhenghan commented 4 years ago

Hi @aryehraber , sent you an email! Thanks so much.

aryehraber commented 4 years ago

@maryzhenghan Thanks for sending it through, I'll reply over email to ensure no sensitive info is shared here.

I will say that everything seems to be working as expected on my end, I'm able to fetch /!/Fetch/pages, /!/Fetch/collection/blog, and more. Each of the data blocks contained all the page/entry data as expected (hidden in screenshots):

I'll close the issue for now since it doesn't seem to be an issue with Fetch. Will email back shortly!