piotrkulpinski / openalternative

A community driven list of open source alternatives to proprietary software and applications.
https://openalternative.co
GNU General Public License v3.0
1.65k stars 63 forks source link

Cron job is giving some errors #25

Closed faisalseraj closed 4 months ago

faisalseraj commented 4 months ago

Hi @piotrkulpinski, I have deployed the project on Vercel, all the envs are properly set.

However, when I run the cron job it gives two errors. HTTPError: Response code 400 (Bad Request) at Request.<anonymous> (file:///var/task/node_modules/got/dist/source/as-promise/index.js:92:42) at Object.onceWrapper (node:events:633:26) at Request.emit (node:events:530:35) at Request._onResponseBase (file:///var/task/node_modules/got/dist/source/core/index.js:604:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Request._onResponse (file:///var/task/node_modules/got/dist/source/core/index.js:646:13) { input: undefined, code: 'ERR_NON_2XX_3XX_RESPONSE', timings: { start: 1715606959419, socket: 1715606959420, lookup: 1715606959426, connect: 1715606959431, secureConnect: 1715606959437, upload: 1715606959439, response: 1715606959811, end: 1715606959813, error: undefined, abort: undefined, phases: { wait: 1, dns: 6, tcp: 5, tls: 6, request: 2, firstByte: 372, download: 2, total: 394 } }, options: { request: undefined, agent: { http: undefined, https: undefined, http2: undefined }, h2session: undefined, decompress: true, timeout: { connect: undefined, lookup: undefined, read: undefined, request: undefined, response: undefined, secureConnect: undefined, send: undefined, socket: undefined }, prefixUrl: '', body: undefined, form: undefined, json: undefined, cookieJar: undefined, ignoreInvalidCookies: false, searchParams: undefined, dnsLookup: undefined, dnsCache: undefined, context: {}, hooks: { init: [], beforeRequest: [], beforeError: [], beforeRedirect: [], beforeRetry: [], afterResponse: [] }, followRedirect: true, maxRedirects: 10, cache: undefined, throwHttpErrors: true, username: '', password: '', http2: false, allowGetBody: false, headers: { 'user-agent': 'got (https://github.com/sindresorhus/got)', 'x-algolia-api-key': 'f679da929d6ccfc278363478ac67a4bc', 'x-algolia-application-id': 'RESFHR832O', 'accept-encoding': 'gzip, deflate, br', 'x-vercel-id': 'iad1::gngwv-1715606957927-6811bea22828' }, methodRewriting: false, dnsLookupIpVersion: undefined, parseJson: [Function: parse], stringifyJson: [Function: stringify], retry: { limit: 2, methods: [ 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' ], statusCodes: [ 408, 413, 429, 500, 502, 503, 504, 521, 522, 524 ], errorCodes: [ 'ETIMEDOUT', 'ECONNRESET', 'EADDRINUSE', 'ECONNREFUSED', 'EPIPE', 'ENOTFOUND', 'ENETUNREACH', 'EAI_AGAIN' ], maxRetryAfter: undefined, calculateDelay: [Function: calculateDelay], backoffLimit: Infinity, noise: 100 }, localAddress: undefined, method: 'POST', createConnection: undefined, cacheOptions: { shared: undefined, cacheHeuristic: undefined, immutableMinTimeToLive: undefined, ignoreCargoCult: undefined }, https: { alpnProtocols: undefined, rejectUnauthorized: undefined, checkServerIdentity: undefined, certificateAuthority: undefined, key: undefined, certificate: undefined, passphrase: undefined, pfx: undefined, ciphers: undefined, honorCipherOrder: undefined, minVersion: undefined, maxVersion: undefined, signatureAlgorithms: undefined, tlsSessionLifetime: undefined, dhparam: undefined, ecdhCurve: undefined, certificateRevocationLists: undefined }, encoding: undefined, resolveBodyOnly: false, isStream: false, responseType: 'text', url: URL { href: 'https://data.us.algolia.com/1/tasks/1/run', origin: 'https://data.us.algolia.com', protocol: 'https:', username: '', password: '', host: 'data.us.algolia.com', hostname: 'data.us.algol

  And 
Screenshot 2024-05-13 at 6 39 28 PM Screenshot 2024-05-13 at 6 40 51 PM

Can you please help how to fix the issue in the cron job?

piotrkulpinski commented 4 months ago

Hi @faisalseraj,

Not 100%, but this looks like an issue with Algolia script. Looks like you're trying to run an Algolia task with id 1 - which does not seem like a valid task id.

Did you set up your Algolia connector task properly? It should be of type on demand connecting to your JSON destination at the endpoint https://yourwebsite.com/tools.json.

If you don't need the algolia automatic index, you can comment out the request in /api/cron endpoint in Remix.

faisalseraj commented 4 months ago

@piotrkulpinski comment the algolia automatic index like this?

Screenshot 2024-05-14 at 12 21 54 AM
piotrkulpinski commented 4 months ago

@faisalseraj Yes, exactly.

faisalseraj commented 4 months ago

@piotrkulpinski Thank you very much, now my cron job run successfully but I don't see any data in my landing page. this is the link to my deployed version of the code https://openalternative-beta.vercel.app/

Can you please look at this and let me know if I am missing something?

piotrkulpinski commented 4 months ago

Well, you'll have to add the data to the database yourself. I'm not sharing any db dump, but it should be fairly easy to get it running.

faisalseraj commented 4 months ago

@piotrkulpinski is it possible to share screenshots? I will add the data myself.

faisalseraj commented 4 months ago

@piotrkulpinski where can I find some dumb data?

faisalseraj commented 4 months ago

@piotrkulpinski I added a record to my supabase using the submit form in the repo itself.

Screenshot 2024-05-14 at 12 00 04 PM

Here's my cron job log

Screenshot 2024-05-14 at 12 04 39 PM

It still shows the same message No results found.

piotrkulpinski commented 4 months ago

The error says can't reach database so I'd start with that. Unfortunately, I can't help you debug this at the moment.