My AWS credits recently expired! Which means...cloud hopping.
The successor to my Spotify "Now Playing" with AWS Lambda website snippet. Now hosted on Azure with Functions in Typescript (instead of AWS with Lambda in python - see that version here).
See it in action on my website.
- Clone repo and open in either Codespaces or VSCode Remote containers
- This will drop you in a container with the necessary VSCode extension (Azure Functions), the required tooling (
func
), and the runtime (node
). - Run
yarn
once after any postcreate steps have completed.
- This will drop you in a container with the necessary VSCode extension (Azure Functions), the required tooling (
- Create your Spotify developer account and get your client secret/refresh token - like outlined in my old guide.
- Deploy with the VSCode 'Azure Functions' extension.
- Select 'anonymous' access
- Do create a storage account
- In the Azure Portal, navigate to your newly created storage account
- Manually create a table with whatever
TableName
you'd like - Copy the
StorageKey
out - Fill in
StorageKey
,StorageAccountName
, andTableName
in your Azure Function's settings (and local settings if you want to debug)
- Manually create a table with whatever
- On the Azure Portal navigate to your Function app's "Configuration" page.
- Add all the secrets into your configuration by hitting the
+ New application setting
button. These secrets are exposed as environment variables to the node application at runtime.
- Add all the secrets into your configuration by hitting the
For local testing, place all your environment variables into a file named local.settings.json
, like so. All of these secrets should also exist in your Function app's "Configuration".
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=.....",
"FUNCTIONS_WORKER_RUNTIME": "node",
"StorageKey": "...",
"RefreshToken": "...",
"ClientIdSecret": "...",
"StorageAccountName": "...",
"TableName": "..."
}
}
Then run yarn start
in the root directory.