libscie / ResearchEquals.com

Research module server
https://researchequals.com
MIT License
88 stars 10 forks source link

Published modules are showing as drafts in the email digest 🐛 #780

Closed nsunami closed 2 years ago

nsunami commented 2 years ago

URL of the Page

(email digest)

What happened?

In the email digest, published modules are still listed as drafts.

For example, the following module is listed as a draft in the digest email:

image

The URL of the link is: https://www.researchequals.com/drafts?suffix=qcwj-d1mp

But clicking it will lead to a blank page in the drafts tab.

In fact, the module with the suffix qcwj-d1mp is already published here: https://www.researchequals.com/modules/qcwj-d1mp

Steps to reproduce

Open a digest email (the account must have a published module)

What browser(s) did you use?

Chrome

Anything else?

No response

nsunami commented 2 years ago

This is a note to self to check app/api/weekly-digest-mailer.ts

nsunami commented 2 years ago

I'm seeing a weird error where I cannot call the API endpoint for quirrel.

Steps that I took:

  1. access http://localhost:3000/api/weekly-digest-mailer on my browser
  2. The server fails and outputs the following error message:
TypeError: Cannot read properties of undefined (reading 'length')
    at getLens (/Users/nami/git/ResearchEquals.com/node_modules/base64-js/index.js:23:17)
    at Object.toByteArray (/Users/nami/git/ResearchEquals.com/node_modules/base64-js/index.js:55:14)
    at unpackMessage (/Users/nami/git/ResearchEquals.com/node_modules/secure-e2ee/dist/base-encryptor.js:104:51)
    at Encryptor.<anonymous> (/Users/nami/git/ResearchEquals.com/node_modules/secure-e2ee/dist/base-encryptor.js:156:30)
    at step (/Users/nami/git/ResearchEquals.com/node_modules/secure-e2ee/dist/base-encryptor.js:75:23)
    at Object.next (/Users/nami/git/ResearchEquals.com/node_modules/secure-e2ee/dist/base-encryptor.js:56:53)
    at /Users/nami/git/ResearchEquals.com/node_modules/secure-e2ee/dist/base-encryptor.js:50:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/nami/git/ResearchEquals.com/node_modules/secure-e2ee/dist/base-encryptor.js:46:12)
    at BaseEncryptor.decrypt (/Users/nami/git/ResearchEquals.com/node_modules/secure-e2ee/dist/base-encryptor.js:151:16)
nsunami commented 2 years ago

I think the error was coming from the fact that there were environment variables set (.env.local & .env.test.local). When I removed the following environment variables, the job ran:

QUIRREL_TOKEN
QUIRREL_BASE_URL
QUIRREL_ENCRYPTION_SECRET
chartgerink commented 2 years ago

For what it's worth - you cannot activate the Quirrel jobs by accessing the endpoint on it's own (here through localhost:3000/api/weekly-digest-mailer). That's not how quirrel works (that would be open to abuse upon deploy).

You need to go to your Quirrel deployment - defaults to http://127.0.0.1:9181 for local build.

Screenshot 2022-10-18 at 10 11 29

You can manually invoke the methods here.

EDIT: Also made sure to note this in the Wiki.