Docker, Nodejs, Serverless: Error: ENOENT: no such file or directory, open '/home/sbx_user1051/.serverlessrc.1568800362'

I keep getting this error after running yarn serverless offline in my docker/nodejs image running inside an aws lambda function. I have a hunch it has to do with readonly lambda file system.

: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command upgrade
Serverless: Load command uninstall
Serverless: Load command offline
Serverless: Load command offline:start
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Load command output
Serverless: Load command output:get
Serverless: Load command output:list
Serverless: Load command param
Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Load command studio
Serverless: Error: ENOENT: no such file or directory, open '/home/sbx_user1051/.serverlessrc.1568800362'
    at Object.openSync (fs.js:462:3)
    at Function.writeFileSync [as sync] (/backend/node_modules/write-file-atomic/index.js:205:13)
    at storeConfig (/backend/node_modules/@serverless/utils/config.js:50:21)
    at createDefaultGlobalConfig (/backend/node_modules/@serverless/utils/config.js:72:3)
    at getGlobalConfig (/backend/node_modules/@serverless/utils/config.js:129:10)
    at getConfig (/backend/node_modules/@serverless/utils/config.js:134:24)
    at Object.getLoggedInUser (/backend/node_modules/@serverless/utils/config.js:188:18)
    at module.exports (/backend/node_modules/@serverless/enterprise-plugin/lib/isAuthenticated.js:5:44)
    at ServerlessEnterprisePlugin.asyncInit (/backend/node_modules/@serverless/enterprise-plugin/lib/plugin.js:541:7)
    at /backend/node_modules/serverless/lib/classes/PluginManager.js:648:82
    at Array.map (<anonymous>)
    at PluginManager.asyncPluginInit (/backend/node_modules/serverless/lib/classes/PluginManager.js:648:39)
    at PluginManager.loadAllPlugins (/backend/node_modules/serverless/lib/classes/PluginManager.js:125:17)
    at Serverless.init (/backend/node_modules/serverless/lib/Serverless.js:166:30)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at /backend/node_modules/serverless/scripts/serverless.js:73:7
Serverless: Unable to store serverless config: /home/sbx_user1051/.serverlessrc due to ENOENT error
 
  Error --------------------------------------------------
 
  Error: ENOENT: no such file or directory, mkdir '/home/sbx_user1051'
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              12.20.2
     Framework Version:         2.25.2 (local)
     Plugin Version:            4.4.3
     SDK Version:               2.3.2
     Components Version:        3.7.0
 
error Command failed with exit code 1.

Reading more about lambda container functions I believe this may have something to do with requirement #3 from aws DOCS but I’m unsure how to cause serverless to use the /tmp folder:

## Lambda requirements for container images

To deploy a container image to Lambda, note the following requirements:

1. The container image must implement the Lambda [Runtime API](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html). The AWS open-source [runtime interface clients](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-images.html#runtimes-api-client) implement the API. You can add a runtime interface client to your preferred base image to make it compatible with Lambda.
2. The container image must be able to run on a read-only file system. Your function code can access a writable `/tmp` directory with 512 MB of storage. If you are using an image that requires a writable directory outside of `/tmp` , configure it to write to a directory under the `/tmp` directory.
3. The default Lambda user must be able to read all the files required to run your function code. Lambda follows security best practices by defining a default Linux user with least-privileged permissions. Verify that your application code does not rely on files that other Linux users are restricted from running.
4. Lambda supports only Linux-based container images.

More documentation: Creating Lambda container images - AWS Lambda