Log into Serverless Platform on a headless system

I am looking at using the Serverless Dashboard and Platform for an application I am building but hit a little roadblocak wrt the need to login. Currently all my deployments happen via a headless CI/CD process (GitLab runner), so I need some alternate way to authenticate to allow my services to be added to the application on the platform. Does anyone know of any alternative such as environment variables I could use by any chance?

1 Like

I guess this is a slightly more difficult problem than I originally thought? If it helps I did find the .serverless.rc file in my home directory from doing a login on my dev machine. Not sure how to re-use that as I can see there are credentials?

Hey @garethmcc. Great question, and I’ll work on adding this to our docs.

To publish with a CI/CD system, you can set the SERVERLESS_ACCESS_KEY environment variable. This value should be an access key that you create in the “secure” tab in the Serverless Dashboard. The access key must belong to the tenant in which you are publishing your service.

Let me know if that helps!

Thanks Alex. I actually did not even see the tab at the top to be honest. I’ll feedback once I get it working. Thanks for the input.

I added the required config values in my serverless.yml, created a key from the dashboard UI, and added the SERVERLESS_ACCESS_KEY environment variable to the CI process but it still has not shown up on the dashboard. A verbose logging of the SLS deployment shows no confirmation that it logged in. I added the sls login command as well but all it did was ask me to open my browser and waited. It seems the deploy is just not logging in for some reason with the SERVERLESS_ACCESS_KEY set.

@alexdebrie1 Does it perhaps only add the service to the dashboard on the initial stack create and not on subsequent updates to the stack?

I’m having the same issue where the app isn’t appearing the dashboard. I tried setting the SERVERLESS_ACCESS_KEY env var too.

I’m also only updating an existing app, not creating it from fresh - so maybe thats the problem?