Ionic-Native/Photo-Library Fatal Exception

I am attempting to do something very simple yet it is causing me much pain.

I have an Ionic v5 Angular 12 application and have installed the Ionic-Native/PhotoLibrary plugin

I am using the Ionic-Native version as recommended by the plugin itself

Here is my code

import { PhotoLibrary } from '@ionic-native/photo-library/ngx';

constructor(private photoLibrary: PhotoLibrary) { }

const blob = new Blob(binaryData, { type: dataType });
this.file.writeFile(this.file.dataDirectory,, blob, { replace: true }).then(() => {
     console.log('file should be saved');
     let libraryItem = this.photoLibrary.saveImage(this.file.dataDirectory +, "RaceApp");   
     console.log('photo should be saved to album');    

When running in android studio I see the following in the console

I/Capacitor/Console: File: https://localhost/main.js - Line 3687 - Msg: file should be saved
D/MediaScannerConnection: Scanned /storage/emulated/0/Pictures/RaceApp/2022-2-9-6.jpeg to content://media/external_primary/images/media/9512

E/AndroidRuntime: FATAL EXCEPTION:
    Process: com.pyrix.racechat, PID: 10114
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.json.JSONObject.toString()' on a null object reference
        at org.apache.cordova.PluginResult.<init>(
        at org.apache.cordova.CallbackContext.success(
        at com.terikon.cordova.photolibrary.PhotoLibrary$5$
        at com.terikon.cordova.photolibrary.PhotoLibraryService$
        at com.terikon.cordova.photolibrary.PhotoLibraryService$5.onScanCompleted(
        at$$ Source:6)
        at android.os.Handler.handleCallback(
        at android.os.Handler.dispatchMessage(
        at android.os.Looper.loopOnce(
        at android.os.Looper.loop(

I do see that the RaceApp Album has been created and the photo is saved to that album. What I do not understand is why the application is crashing and that error is being shown.