When using Firebase SDK with cloud function to send push notification, below are the errors and its description related to iOS.
"messaging/third-party-auth-error"
This error means that the authentication with the APNS failed. This is most likely due to not uploading the APNS key in the Firebase Cloud Messaging Settings.
"messaging/invalid-argument"
This error is thrown when there is an issue with the token. This can arise from an invalid or expired token. This could also arise when a token obtained from iOS simulator is used. It's better to test push notification using a iOS device. Later versions of Xcode supports push notification on simulator but needs additional configuration.
Monday, June 19, 2023
Sunday, June 18, 2023
Delete a file from git history
I have tried multiple commands to delete a file entirely from the git and its history. This is what worked without any issues. This requires force push the changes.
After that force push to the repo.
$ git filter-branch --force --index-filter "git rm --cached --ignore-unmatch path-to-file-to-remove.txt" --prune-empty --tag-name-filter cat -- --allIf there is space in the path escape with a slash
\
.After that force push to the repo.
$ git push -u origin main --force
Thursday, June 15, 2023
Setting Up Remote Git Sync In Working Copy on macOS
Working Copy is an iOS git client app. It has a good text editor and a pleasant UI. Since it is a git client it can sync with remote git servers. Here I will decribe how to sync within internal network running git server on macOS.
1. Install Simple Git Server on macOS.
2. Under repositories create a new repository. I use Working Copy mainly for journalling. So I will create a repo named
3. Start the git server. It will show two URLs. One with IP and other with local domain name. Use the domain name URL as it's constant.
4. Checkout the created repo under mac.
6. Add a file
7. Go to macOS Terminal and run
This gives us a fully locally synced git repository. After finding Obsidian not working for me, I have moved all files to Working Copy and now uses it for my journal. I write journals in plain text files, so this setup works well.
1. Install Simple Git Server on macOS.
2. Under repositories create a new repository. I use Working Copy mainly for journalling. So I will create a repo named
journal.git
. Use .git
extension ticked.3. Start the git server. It will show two URLs. One with IP and other with local domain name. Use the domain name URL as it's constant.
4. Checkout the created repo under mac.
$ git clone git://ataraxia.local/journal.git5. Open Working Copy on iPhone and create a new directory. Let's call personal. We cannot move repositories to new directory once cloned. Once in the directory, tap on the plus button and choose clone repository. For the url give
git://ataraxia.local/journal.git
and tap clone.6. Add a file
sync-test.txt
to test the syncing. Commit the file with push radio button enabled. This will sync the changes to remote.7. Go to macOS Terminal and run
$ git pullThis will show output like below.
jsloop@ataraxia journal % git pull remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), 220 bytes | 220.00 KiB/s, done. From git://ataraxia.local/journal * [new branch] main -> origin/main Your configuration specifies to merge with the ref 'refs/heads/master' from the remote, but no such ref was fetched.Here we can see that the repo fetched all remote branches which is
main
but did not checkout the fetched branch. Let's checkout the main branch.
jsloop@ataraxia journal % git checkout main branch 'main' set up to track 'origin/main'. Switched to a new branch 'main'Now that the files are checked out, use
ls
to view the synced files. Any changes made from the macOS and sycned with remote will appear on Working Copy on pull. I use terminal and Fork app for git GUI on macOS.This gives us a fully locally synced git repository. After finding Obsidian not working for me, I have moved all files to Working Copy and now uses it for my journal. I write journals in plain text files, so this setup works well.
Tuesday, June 13, 2023
Obsidian Content Search
While Obsidian is a great app, the search is rudimentary. It searches only the file name and not content. In order to search for contents, luckily we have a community plugin Omnisearch which searches through file content as well. This can be installed from the community plugin section of the app.
Sunday, June 11, 2023
Journalling on iPhone using Obsidian
I just came by Obsidian app which is a note taking application available on all platforms. I have been using DEVONthink Pro since 2018. I bought the mac and iOS apps mainly because it offers seamless offline syncing between these two apps. I can write my journal on iPhone and sync it to mac all offline. It's a bit involved but not that complicated to setup offline sync. The main issue that I face now with DEVONthink is that mine is version 2 and now the latest supported version is 3. Version 2 is no longer supported and the app crashes on iPhone when searching for anything.
I found that Obsidian is really good for writing notes. Notes are saved as markdown (.md) files in the local file system. These appear when we connect iPhone to the mac and can be easily backed up by dragging and dropping the folder. I read that there are plugins for syncing but a simple copy works for me. Also, the Obsidian app is free for personal use.
Update on 15 June 2023
I have migrated all my notes from DEVONthink to Obsidian. Now the app is taking more than 20 seconds to open an offline vault containing 283 plain markdown files. This is unusable for me. So I moved away from Obsidian to Working Copy.
I found that Obsidian is really good for writing notes. Notes are saved as markdown (.md) files in the local file system. These appear when we connect iPhone to the mac and can be easily backed up by dragging and dropping the folder. I read that there are plugins for syncing but a simple copy works for me. Also, the Obsidian app is free for personal use.
Update on 15 June 2023
I have migrated all my notes from DEVONthink to Obsidian. Now the app is taking more than 20 seconds to open an offline vault containing 283 plain markdown files. This is unusable for me. So I moved away from Obsidian to Working Copy.
Thursday, June 8, 2023
Android Simulator Internet Access on Hotspot
Sometimes the internet access in the Android simulator does not work if connected to an iPhone Hotspot. Chrome won't load any page, apps cannot connect to servers. This can be fixed by added a public DNS under the Network settings in System Preference in macOS. Choose the Hotspot connection > Advanced > DNS and under the DNS Servers: add 8.8.8.8 and 8.8.4.4. Then relaunch the emulator to get internet access.
Azure Function Slots For Staging Env
Azure Functions are serverless cloud computing platform offered by Microsoft. When we create an Azure Function, the default one is considered as production. This has the URL
To deploy to a slot we can use the Azure Account extension. Login using the Azure credentials and navigate to the slot as shown in the screenshot.
Right clicking on a slot, there is option to deploy. And this will deploy the cloud function to the corresponding slot.
https://<function-name>.azurewebsites.net
. For development and testing purposes it is essential that we have a staging environment as well. And Azure Functions offer this in the form of Slots. Slots provide a different environment under the main function project. These have URL https://<slot-name>.azurewebsites.net
. We can deploy the cloud function to slot and it acts as another environment completely.
To deploy to a slot we can use the Azure Account extension. Login using the Azure credentials and navigate to the slot as shown in the screenshot.

Wednesday, June 7, 2023
Firebase Token Retrieval Failed: SERVICE_NOT_AVAILABLE
When running Firebase Messaging based app under Android emulator, if we are getting the error
W/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE. Will retry token retrieval
, this most likely means that the fcm messaging token retrieval failed due to inability to connect to the server. Check the internet connectivity inside the emulator. I was running the app with iPhone Hotspot and the emulator had no internet connectivity. Once the connectivity issue got resolved, the token generation succeeded.
Friday, June 2, 2023
Enable Horizontal Scrolling for Code in Blogger
For code snippets we use
pre
tag in blogger. These appear in a straight line and breaks out of the layout. To enable scrolling for pre
tags add overflow: auto;
.
pre { overflow: auto; }
Subscribe to:
Posts (Atom)