Updating user metadata with base64 image

I am trying to include two versions of a users profile image in their user_metadata. A URL pointing to an image file of the profile image and base64 encoded text string of the image.

I am able to update the user_metadata successfully, but when i try login, it seems one of my rules fail with

 {
   "code": 400,
   "error": "Script exceeds the size limit.",
   "message": "Script exceeds the size limit of 102400.",
   "error_source": "sandbox"
 }

I cant quite see which rule this is happening on as it seems to happen just after the login script executes (using custom database options). Perhaps its throwing this error when i tries to pass the profile to the next rule from the login?

My question is, since the user_metadata an hold up to 16mb of data, according to the docs, what is the correct way to handle large data in the scripts/rule pipeline? At some point the metadata objects may exceed the 102400 byte limit, even without adding large single data values, how do we manipulate the profile data in this case?

As you pointed the user metadata can indeed hold data above the size limit mentioned in the error, however, when using rules the actual size of the data that you can include as part of user metadata is reduced; if you require rules then you’ll need to consider this additional limitation.

For reference purposes here is the documentation that mentions this situation:

Is there a way to exclude metadata from the profile in rules? For instance i might not need to access the profile data inside a rule or will it always be passed along to the rules pipeline? If so then we can say that the profile size cannot ever exceed the script limit or logins will cease to work?

Is there a way to exclude metadata from the profile in rules? For instance i might not need to access the profile data inside a rule or will it always be passed along to the rules pipeline? If so then we can say that the profile size cannot ever exceed the script limit or logins will cease to work?

Unfortunately there’s no way to exclude metadata from the rules pipeline so like you said, when using rules the profile size will be limited by the limits imposed on rules.