-
Notifications
You must be signed in to change notification settings - Fork 555
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
The Search API does not work on mobile devices. #3278
Comments
Hi, you'll need to provide some more details so we can diagnose this. Search API definitely works on mobile you can open https://omnivore.app on mobile to verify. Do you have some sample code we could look at? |
I apologize for not providing enough information. Here is the code async function fetchTraces(authToken) {
let mappedResults = [];
try {
const cursor = 0;
const limit = 10;
const data = JSON.stringify({
variables: {
after: "0",
first: 30,
format: "",
includeContent: false,
query: "sort:updated-desc"
},
query: `query Search(
$after: String
$first: Int
$query: String
$includeContent: Boolean
$format: String
) {
search(
first: $first,
after: $after,
query: $query,
includeContent: $includeContent,
format: $format
) {
... on SearchSuccess {
edges {
node {
id
title
slug
siteName
originalArticleUrl
url
author
updatedAt
description
savedAt
pageType
content
publishedAt
readAt
wordsCount
isArchived
readingProgressPercent
archivedAt
contentReader
}
}
pageInfo {
hasNextPage
endCursor
totalCount
}
}
... on SearchError {
errorCodes
}
}
}
`,
});
const url = `https://api-prod.omnivore.app/api/graphql`;
const completedTraceMetadata = await fetch(url, {
method: 'POST',
headers: {
"Content-Type": "application/json",
"Authorization": "${authToken}",
"X-OmnivoreClient": "obsidian"
},
body: data
}).then(function(response) {
return response.json();
}); |
OK, my guess is what you are hitting here is a CORs error. Can you look in the developer console and on the network tab? |
Thanks, I didn't understand that you were running within Obsidian. I am still guessing this is related to CORS somehow. I wonder if on Mac Obsidian is proxying the fetch request to avoid CORs but on iOS its running through the browser. Is this installed as a plugin? |
Yes, this is a obsidian plugin I wrote myself. In this plugin, I fetch data from Omnivore for processing. ![]() const url = `https://api-prod.omnivore.app/api/graphql`;
const RequestUrlParam = {
url: url,
method: 'POST',
headers: {
"Content-Type": "application/json",
"Authorization": "${authToken}",
"X-OmnivoreClient": "obsidian"
},
body: data
};
try {
console.log("before http request");
const response = await requestUrl(RequestUrlParam);
console.log(response);
} catch (e) {
console.log(JSON.stringify(e));
} |
Can you paste the full stack here? (Make sure it doesn't have your token in it) |
Do you means the result of |
Yeah |
Long shot because its hard to tell from our logs, but there was a request right around that time with an invalid API key. Maybe in the code update the Also, your key was visible in a previous screenshot, so you should probably delete that key on our API keys page. |
Indeed, it was indeed the token error that caused the problem. Now the API calls are working correctly. Thank you so much for your guidance! |
Awesome, please let us know more about your tool when you have it ready to demo...if you plan on sharing it. Might want to checkout our Discord also. I'll close this one out, but let me know if there are still issues |
It is a plugin that pulls out articles from the Omnivore archive that you have read on a given day and writes them into your Obsidian journal. I wrote it based on this plugin. If anyone is interested, I would be happy to share it. |
I think people would really like this actually |
I wrote a script for Obsidian that retrieves archived data through an API.
It runs successfully on Mac, but when executed on iOS, it throws a TypeError: Load failed error.
My network connection is fine.
The text was updated successfully, but these errors were encountered: