quirrel-dev / quirrel-next

Moved to main Quirrel repo.
https://github.com/quirrel-dev/quirrel
MIT License
20 stars 2 forks source link

Getting a 500 when using deployed to production #3

Open casesandberg opened 3 years ago

casesandberg commented 3 years ago

Everything works fine in dev, however we are getting a 500 when trying to use it in production. When scheduling a task I am getting:

Error: Unexpected status: 500
    at QuirrelClient.<anonymous> (/var/task/node_modules/@quirrel/client/dist/src/index.js:151:35)
    at step (/var/task/node_modules/@quirrel/client/dist/src/index.js:44:23)
    at Object.next (/var/task/node_modules/@quirrel/client/dist/src/index.js:25:53)
    at fulfilled (/var/task/node_modules/@quirrel/client/dist/src/index.js:16:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Not sure how to go about debugging this. We have the QUIRREL_TOKEN and QUIRREL_ENCRYPTION_SECRET set like the documentation says. We are setting the QUIRREL_BASE_URL to reference the VERCEL_URL so that it will work on both our preview builds and our production builds.

Skn0tt commented 3 years ago

Could it be that you forgot to prefix the QUIRREL_BASE_URL with https:// ? I think the VERCEL_URL doesn‘t include that. I should also add better error descriptions for this, I suppose 😅

Skn0tt commented 3 years ago

Having it directly tied to the VERCEL_URL also creates problems for the Production deployment (aka jobs will always be executed against the version that they were deployed with, even if you fixed an important bug in a newer one).

Skn0tt commented 3 years ago

What‘s the reason you tied QUIRREL_BASE_URL to VERCEL_URL?

casesandberg commented 3 years ago

Ah, I see what you are saying now, I will try that.

We pretty much just want to be able to test in the preview builds that Vercel creates (they are auto-generated URLs that we do not have control of) as well as it working in production. Maybe there is a better way to do this?

Skn0tt commented 3 years ago

I‘ll sleep over it and get back to you with an answer tomorrow.

casesandberg commented 3 years ago

Great, thanks! I will think on it too.

Skn0tt commented 3 years ago

Alright! After a good night's sleep on the issue, I guess this is the way to go:

I'll add a heuristic to the Quirrel client that automatically prefixes URLs with https:// if no protocol is present. That way, it will work with VERCEL_URL.

Does that sound about right for your usecase? Anything else you think I missed, that I should consider with this?

casesandberg commented 3 years ago

Yes, that would be fantastic! That looks like it would solve are problem.