-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
…separate lambda with middy.js
…ge gate change requests
Okay so I think this PR is actually basically in a ready state to merge if we wanted to, but here's the loose ends:
As soon as we moved away from hard-coded data in the back-end to linking to the database, we basically stopped testing the back-end because I couldn't get proper test mocking to work to remove the Prisma client. I haven't thought about it yet, but I'm kinda guessing that this new pattern may be easier to test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the way this is looking, there's certainly a lot more to look into on this front, but validation looks a lot simpler now.
Update: I did a test deploy and the Netlify Deploy Preview build failed so I put in a request to ITS to request those logs so we can determine what's wrong. It's possible it's just a lint error, or it could be something worse. |
As recommended by @acd124, it looks like changing to the new https://answers.netlify.com/t/error-could-not-find-encoding-module-in-file-netlify-function/2259/19 |
yet now I get another error that says utils js file exports is not found. I suspect it might have something to do with the new node bundler since that enables esmodule syntax natively supported by the functions when originally we set up the utils package (for usage with the functions) to use commonJS module syntax. alas, this switch did not fix it so I am awaiting ITS' response for logs again |
https://answers.netlify.com/t/lambda-function-es-module-support/30673/16 The answer to the problem is likely somewhere in this thread, though we'll have to wait for the logs to confirm what the right solution is. I believe the final messages in the thread say that using esbuild bundler does work, but we may want to specify using node 14. |
Hi, hope you're enjoying using Middy. Saw you linked to a middy issues, so thought I'd poke around. Wanted to let you know that v3 will have a |
Following research into https://answers.netlify.com/t/local-npm-dependency-in-package-json-not-installing/22291/14 the current best solution for making sure utils is properly installed is to include the preinstall script in the build script. Looking into the underlying cause shows that it is an issue with netlify's caching and there is an issue open netlify/build-image#523 about it. There is also a solution pending that could fix it as shown in netlify/build-image#513 more research might be done to see if there are useful tools or changes to be learned here about our deployment process, but for now the main goal is to get the app running. |
Thank you @willfarrell! Really excited to see v3 come out! |
Okay! I looks like adding |
The front-end doesn't work because of the env variable naming, but I can still send requests to the back-end via Thunder Client (VSCode integrated Postman). Sending requests to this new endpoint properly trigger "event object failed validation" so I'd like to believe that it's actually fully working. Obviously we still need to do stuff for the production database and stuff, but this is a huge step forward. |
Okay so this one is kinda interesting. I'm learning just how little I know / knew about AWS Lambda. I'm also realizing how long a single create endpoint can get compared to the dinky simple get endpoints we started with. It really shows how naive I was in thinking that endpoints would be small enough to bundle together with route matching.
This honestly probably is the better way to architect our backend. It just feels so much cleaner. And probably more testable honestly, though I haven't given that a shot yet.
This likely also puts us in a much better spot for a future in which we might consider migrating to full-fledged AWS instead of riding off of Netlify, but that future scares me given how little DevSecOps knowledge our team has at the moment.