Skip to content

AppFlow appending timestamp to filenames even when I have selected no timestamp option

1

I have created a Flow in AppFlow to download data from Salesforce and save it down in S3 bucket. I do not want to append timestamp, because if I do so, then DataBrew cannot load the file because of special characters in filename. However, AppFlow keeps appending the timestamp to the files it creates. I have double checked that the timestamp option is not selected, and I have tried using different formats. This is most likely a problem with the AWS code.

Another issue is that when the file is saved, no extension is being added; e.g. csv, json etc. are missing from the filename. This is not a big issue, but still points to an issue with the service code.

Can someone please help fix these issues? I am not partitioning the data as I just want a single file for each incremental download.

  • Hi nk,

    Thanks for sharing your question! It sounds like you're encountering a frustrating issue with AppFlow. To help the community provide more targeted assistance, could you share a bit more information? For example:

    1. Could you confirm which specific formats you’ve tried and whether the problem persists across all of them?
    2. Are you using any transformations or filters in your AppFlow configuration that might affect the filenames?
    3. Are there any error messages or logs indicating why the extensions are missing or why timestamps are being appended?

    Sometimes, behavior like this could stem from default configurations or specific feature interactions within AppFlow. If you can provide those additional details, it would help narrow things down.

    Looking forward to your reply! 😊 Cheers, Aaron ✨

  • Thanks. I think I had included the info you're asking for, but let me put it here again:

    I have tried mutiple formats - tried to save the files down as csv, json etc. The problem occurs in every format No transformations - just copying all fields as such There is no error message. The Flow seems to be working fine, it copies the data into S3 buckets, but forgets to properly name the file (no extension) and adds timestamp which I haven't asked for.

1 Answer
0

Greeting

Hi nk!

Thanks for sharing the details of your AppFlow challenges! I understand how frustrating it must be to see unexpected timestamps in your filenames and missing extensions when you've carefully configured your flow. Let’s dig into this and find a practical solution for you. 😊


Clarifying the Issue

From your description, it seems that you're encountering two specific issues in AWS AppFlow while exporting Salesforce data to S3:

  1. Unexpected Timestamps: AppFlow appends timestamps to filenames even when you've disabled that option, potentially causing compatibility issues with downstream tools like DataBrew.
  2. Missing File Extensions: The saved files lack extensions such as .csv or .json, which makes it harder to identify or process the files further.

You’ve shared that:

  • The issues occur regardless of the file format (CSV, JSON, etc.).
  • There are no transformations or filters applied; all fields are being copied as-is.
  • No error messages appear, indicating that the flow itself executes successfully.

It sounds like you've double-checked the configurations, but AppFlow's behavior isn't aligning with your settings, which can be frustrating. Let’s address this step-by-step.


Why This Matters

Properly named and formatted files are crucial for seamless integration with tools like DataBrew. Unexpected timestamps or missing extensions add unnecessary complexity, requiring additional preprocessing or manual intervention. Resolving this ensures your workflow remains efficient and error-free.


Key Terms

  • AppFlow: A managed service for automating data transfer between SaaS apps and AWS services.
  • S3 (Simple Storage Service): Scalable object storage service where AppFlow saves output files.
  • DataBrew: A data preparation tool in AWS for cleaning and normalizing data.
  • Lambda Function: A serverless compute service that runs code in response to triggers like S3 events.

The Solution (Our Recipe)

Steps at a Glance:

  1. Ensure that AppFlow filename patterns explicitly exclude timestamps.
  2. Add file extensions explicitly in AppFlow’s S3 configuration.
  3. Implement an AWS Lambda function to rename files post-upload (if necessary).
  4. Test Your Flow and Adjust.

Step-by-Step Guide:

  1. Ensure that AppFlow filename patterns explicitly exclude timestamps:
    • Navigate to the Destination step in your AppFlow configuration.
    • Under File Naming Options, confirm that the Timestamp checkbox is unchecked.
    • Ensure the File Name Pattern field does not include placeholders like ${timestamp} or similar variables.

  1. Add file extensions explicitly in AppFlow’s S3 configuration:
    • In the same Destination step, define your file name and include the desired extension.
    • For example, use salesforce_data.csv instead of salesforce_data.

  1. Implement an AWS Lambda function to rename files post-upload (if necessary):
    If AppFlow continues to append timestamps or omit extensions, automate cleanup with a Lambda function triggered on S3 object creation:

    import boto3
    import os
    
    s3 = boto3.client('s3')
    
    def lambda_handler(event, context):
        bucket_name = event['Records'][0]['s3']['bucket']['name']
        key = event['Records'][0]['s3']['object']['key']
    
        # Ensure file has correct extension
        if not key.endswith('.csv'):
            new_key = key.split('.')[0] + '.csv'  # Adjust extension as needed
            copy_source = {'Bucket': bucket_name, 'Key': key}
            
            # Copy the object with the new name
            s3.copy_object(Bucket=bucket_name, CopySource=copy_source, Key=new_key)
            
            # Delete the old object
            s3.delete_object(Bucket=bucket_name, Key=key)
    • Deploy this Lambda function via the AWS Management Console.
    • Set it to trigger on S3 PUT events.
    • Adjust the extension (e.g., .json) based on your file format.

  1. Test Your Flow and Adjust:
    • Run your AppFlow to verify that the filenames now match your requirements.
    • Check your S3 bucket to ensure proper extensions and no unexpected timestamps.

Closing Thoughts

Addressing these filename and extension issues ensures smooth integration with tools like DataBrew, simplifying your workflow and saving time. By leveraging AppFlow settings or Lambda for post-processing, you can fully automate the process and avoid manual fixes.

Documentation Links:


Farewell

I hope these steps help you resolve the challenges with AppFlow! Let me know if you need further clarification or assistance. Wishing you smooth file exports and successful workflows! 🚀😊


Cheers,

Aaron 😊

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.