Two issues, that might related.
First. when publishing a new document from the content editor I get an Error.
and that returns a 500. but then somehow it gets published.
Now, when on development trying to preview a document it works fine while is not published, but when published and click preview, the API returns a 404 that the document isn't found.
I would assume this is an internal issue on your product and given that the publishing gives a 500 not all the needed task are executed therefore causing a 404 return.
error - PrismicError: No documents were returned on click preview on published document.