Skip to main content
Participant
December 13, 2021
Question

Unable to import module: adobe in aws lambda

  • December 13, 2021
  • 1 reply
  • 801 views

I have created a zip file by installing library in a folder bu using command

Pip install pdfservices-sdk -t .

 

And it was successful and i added a layer in aws lambda and tried running code but i think library is working with code.

 

Can anybody has solution to this?

 

    This topic has been closed for replies.

    1 reply

    Raymond Camden
    Community Manager
    Community Manager
    December 14, 2021

    Can you share more information? In the post above you said you think the library is working, but I'm assuming you mean *not* working?

    Participant
    December 15, 2021

    Hi Raymond,

     

    I have tried creating layer and the main code file in ec2 linux instance. Because i thought it might be due to OS dependencies, as lambda uses linux and i was using windows.

    Now the code is runing but file is not being saved it shows error like,

     

    Response
    {
    "errorMessage": "[Errno 18] Invalid cross-device link: '/tmp/extractSdkResult/b0ad3e245d6211eca02c3e63cbdf52ea.zip' -> '/var/task/ExtractTextInfoFromPDF.zip'",
    "errorType": "OSError",
    "stackTrace": [
    " File \"/var/task/lambda_function.py\", line 40, in lambda_handler\n result.save_as(\"./ExtractTextInfoFromPDF.zip\")\n",
    " File \"/opt/python/adobe/pdfservices/operation/internal/io/file_ref_impl.py\", line 45, in save_as\n os.rename(self._file_path, abs_path)\n"
    ]
    }

     

    It is not saving file.

    I have tried shutil.copy() mtd instead of os.rename() in adobe library but still file is not getting saved

     

    If you think i can use another mode  instead of using this line

    # Execute the operation.
    result: FileRef = extract_pdf_operation.execute(execution_context)

    # Save the result to the specified location.(THIS ONE)
    result.save_as("./ExtractTextInfoFromPDF.zip")

     

    Participant
    February 7, 2022

    Did anyone find the solution to this issue? I have the exact same problem