Hello fellow Redwood Users deploying with Serverless:
I’m hoping to get some clarity from @thedavid on the actual problems eventually. I believe the NodeJS version thing is a red herring. From what I’ve observed, it looks more like the AWS two-part deploy, with front-end and back-end each living in their own domain (CloudFront assigned URL & API Gateway assigned URL, respectively) causes a lot of pain for their CI/CD workflow with dbAuth.
Front-end & back-end being in separate domains introduces CORS issues, as well as third-party cookie issues for dbAuth. Addressing the CORS issue is akin to resolving a circular dependency. Already, the front-end needs to know the back-end URL, but for CORS, the back-end also needs to be configured with the domain of the front-end. The Serverless deploy already has the --first-run
flag to handle connecting the front-end to the back-end, but configuring CORS means, at a minimum, doing a deploy, finding out the CloudFront URL, editing code and serverless.yml with the front-end origin then doing another deploy with the code & configuration fixes.
IMO, the third-party cookie issue is worse. I don’t know about the RWJS CI/CD pipeline, but in real-world usage, it’s not practical to require browsers to accept third party cookies. Of course, for production, one would almost certainly put both front & back ends in the same domain. The Serverless Framework doesn’t “just do” this.
Using the Serverless ‘stage’ concept to spin up new environments with minimal fuss is a huge advantage, but the current state of the Serverless deploy configuration leaves too much ‘fuss’ to deal with manually.
I’ve seen a lot of people suggest alternate approaches (Serverless Stack, AWS CDK, etc), but (IMO) until the issues with the Serverless deploy are correctly identified it doesn’t make sense to look at other solutions. If I’ve correctly identified the issues as being CORS & third-party cookie complications arising from front-end & back-end living in separate domains, I don’t believe solutions like SST or CDK will “just do” the necessary work to resolve that. But I do think the issue of putting both front-end & back-end under a single domain is solvable, hopefully with minimal fuss, with any of the AWS deploy solutions, including Serverless Framework.