serverless-rack icon indicating copy to clipboard operation
serverless-rack copied to clipboard

Interoperability with serverless-offline

Open HoneyryderChuck opened this issue 11 months ago • 0 comments

Trying to set up a project with serverless-rack and serverless-offline.

I've started only with serverless-rack, however I have authorizer functions defined for the http config, which don't get called when running serverless-rack standalone.

Because of that, I looked into using serverless-offline, which invoke authorizers, and integrates with ruby. The problem is that, whenever I run sls offline start, gem dependencies are installed every single time. This seems to be some issue with the "packaging bundle" step of serverless-offline, which somehow isn't well connected with serverless-rack (?).

But that's not all: if I run sls offline start, which packages gem dependencies for me (so, I shouldn't need to perform bundle install beforehand), running the authorizer function will fail regardless, saying "/usr/local/lib/ruby/3.2.0/bundler/definition.rb:524:inmaterialize': Could not find aws-sdk-kms-1.37.0, aws-xray-sdk-0.11.5, datado..., the typical error which is called when dependencies weren't installed. This seems to be yet another misconfiguration between serverless-rack and serverless-offline, which expect dependencies to be installed in different places (serverless-offline does not run the invoke script with bundle exec`, would that be the issue?).

I've fixed this temporarily by running everything in a docker container and running bundle install (what serverless-rack expects) before running sls offline start(which will reinstall the same set of dependencies someplace else).

HoneyryderChuck avatar Mar 13 '24 13:03 HoneyryderChuck