<@U8R3HMY8G> are you able to clone the project? If...
# prisma-whats-new
s
@Kevin S are you able to clone the project? If so, do that, turn off all the functions and then one by one see if you can refactor so that they are webhooks that call off to another FaaS provider. I’ve been doing this for the last couple of weeks. Essentially making a pub/sub receiver for each function that returns immediately, and then doing the heavy lifting on Lambda/Cloud Functions/etc. Not the news you want to hear, but that was my solution.
For instance, rather than processing a “report” inline as a function, I call out to Google Cloud Functions like this: const PubSub = require(
@google-cloud/pubsub
); const pubsub = new PubSub(); const topicName = ‘report-creation’; const cors = require(“cors”)(); exports.requestReport = (req, res) => { cors(req, res, () => { const data = JSON.stringify(req.body.data); const dataBuffer = Buffer.from(data); pubsub .topic(topicName) .publisher() .publish(dataBuffer) .then(results => { const messageId = results[0]; console.log(
Message ${messageId} published.
); res.send(messageId) }) .catch(err => { console.error(‘ERROR:’, err); res.send(err) }); }) }
k
Thanks for the suggestion.
Unfortunately my timeline to get this operational is like 2 days.
It's not a very complex project (I believe it was actually developed entirely within the console)
But there just isn't enough time for that level of refactoring.
s
Okay, I also faced that “it’s got to be live!” and I just had to refactor the entire thing because there was no way to rely on the functions executing with large volumes.
Hope you can get there. Happy to help if I can be of use. @nilan <- Kevin is having some urgent trouble here.
n
hiho 👋 the 502 is returned if you have a syntax error in your function 🙂
we can help you find it if you share the code @Kevin S
k
Thanks for the reply (sorry about the delay). I've run the code through a separate syntax checker, and found the error.
I find it flabbergasting that not only would a syntax error not be reported in the UI (I had to dig through the inspector to even realize an error had happened)
But that it would totally lock up the entire site with a modal "saving" animation
And the only possible action is to hit 'ESC' to cancel a background dialog... completely undoing all changes, and closing the editor so they can't even be reviewed.
Regardless, I do appreciate the help.