AWS Lambda Request Error post PDF Generation



  • I sent a request to a AWS Lambda function and in the logs I can see that my pdf was formed correctly however at the auto cleanup part I am facing the following errors. Can I have some assistance with this issue? Here are the logs

    2024-05-08T12:27:52.020-04:00
    2024-05-08T16:27:52.020Z cd88a1a0-8c28-42a4-b0e2-bcdb8cfa8110 INFO handling event

    2024-05-08T16:27:52.020Z cd88a1a0-8c28-42a4-b0e2-bcdb8cfa8110 INFO handling event
    2024-05-08T12:27:52.319-04:00
    2024-05-08T16:27:52.319Z - warn: Failed persist profile ENOENT: no such file or directory, open '/tmp/jsreport/autocleanup/6b922c12-a7a7-4e6c-8fc4-fb3315c1d0c1.log' errno=-2, code=ENOENT, syscall=open, path=/tmp/jsreport/autocleanup/6b922c12-a7a7-4e6c-8fc4-fb3315c1d0c1.log, stack=Error: ENOENT: no such file or directory, open '/tmp/jsreport/autocleanup/6b922c12-a7a7-4e6c-8fc4-fb3315c1d0c1.log'

    2024-05-08T16:27:52.319Z - warn: Failed persist profile ENOENT: no such file or directory, open '/tmp/jsreport/autocleanup/6b922c12-a7a7-4e6c-8fc4-fb3315c1d0c1.log' errno=-2, code=ENOENT, syscall=open, path=/tmp/jsreport/autocleanup/6b922c12-a7a7-4e6c-8fc4-fb3315c1d0c1.log, stack=Error: ENOENT: no such file or directory, open '/tmp/jsreport/autocleanup/6b922c12-a7a7-4e6c-8fc4-fb3315c1d0c1.log'
    2024-05-08T12:27:52.320-04:00
    2024-05-08T16:27:52.320Z - info: Render request 2 queued for execution and waiting for available worker rootId=ih3uf90gbu03vek, id=ih3uf90gbu03vek

    2024-05-08T16:27:52.320Z - info: Render request 2 queued for execution and waiting for available worker rootId=ih3uf90gbu03vek, id=ih3uf90gbu03vek
    2024-05-08T12:27:52.321-04:00
    2024-05-08T16:27:52.321Z - debug: fs journal was not synced for a while, need full reload

    2024-05-08T16:27:52.321Z - debug: fs journal was not synced for a while, need full reload
    2024-05-08T12:27:52.321-04:00
    2024-05-08T16:27:52.321Z - info: fs store is loading data

    2024-05-08T16:27:52.321Z - info: fs store is loading data
    2024-05-08T12:27:52.358-04:00
    2024-05-08T16:27:52.350Z - info: Starting rendering request 2 rootId=ih3uf90gbu03vek, id=ih3uf90gbu03vek

    2024-05-08T16:27:52.350Z - info: Starting rendering request 2 rootId=ih3uf90gbu03vek, id=ih3uf90gbu03vek
    2024-05-08T12:27:52.358-04:00
    2024-05-08T16:27:52.350Z - warn: Error when processing render request 2

    2024-05-08T16:27:52.350Z - warn: Error when processing render request 2
    2024-05-08T12:27:52.358-04:00
    (because) template must contains _id, name, shortid or content attribute

    (because) template must contains _id, name, shortid or content attribute
    2024-05-08T12:27:52.358-04:00
    Error: Template must contains _id, name, shortid or content attribute

    Error: Template must contains _id, name, shortid or content attribute
    2024-05-08T12:27:52.358-04:00
    at module.exports (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)

    at module.exports (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)
    2024-05-08T12:27:52.358-04:00
    at WorkerReporter.createError (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:53:12)

    at WorkerReporter.createError (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:53:12)
    2024-05-08T12:27:52.358-04:00
    at AsyncFunction.<anonymous> (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/templates.js:14:24)

    at AsyncFunction.<anonymous> (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/templates.js:14:24)
    2024-05-08T12:27:52.358-04:00
    at ListenerCollection.fire (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/listenerCollection.js:157:32)

    at ListenerCollection.fire (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/listenerCollection.js:157:32)
    2024-05-08T12:27:52.358-04:00
    at async beforeRender (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:24:5)

    at async beforeRender (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:24:5)
    2024-05-08T12:27:52.358-04:00
    at async WorkerReporter._render (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:147:7)

    at async WorkerReporter._render (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:147:7)
    2024-05-08T12:27:52.358-04:00
    at async /opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/reporter.js:227:24

    at async /opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/reporter.js:227:24
    2024-05-08T12:27:52.358-04:00
    at async processAndResponse (/opt/nodejs/node_modules/@jsreport/advanced-workers/lib/workerHandler.js:41:17) rootId=ih3uf90gbu03vek, id=ih3uf90gbu03vek

    at async processAndResponse (/opt/nodejs/node_modules/@jsreport/advanced-workers/lib/workerHandler.js:41:17) rootId=ih3uf90gbu03vek, id=ih3uf90gbu03vek
    2024-05-08T12:27:52.358-04:00
    2024-05-08T16:27:52.350Z - warn: Rendering request 2 finished with error in 251 ms rootId=ih3uf90gbu03vek, id=ih3uf90gbu03vek

    2024-05-08T16:27:52.350Z - warn: Rendering request 2 finished with error in 251 ms rootId=ih3uf90gbu03vek, id=ih3uf90gbu03vek
    2024-05-08T12:27:52.360-04:00
    2024-05-08T16:27:52.360Z cd88a1a0-8c28-42a4-b0e2-bcdb8cfa8110 ERROR Invoke Error
    {
    "errorType": "Error",
    "errorMessage": "Template must contains _id, name, shortid or content attribute",
    "weak": true,
    "statusCode": 400,
    "logged": true,
    "previousOperationId": "la4p6e1b8wvas12",
    "stack": [
    "Error: Template must contains _id, name, shortid or content attribute",
    " at module.exports (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)",
    " at WorkerReporter.createError (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:53:12)",
    " at AsyncFunction.<anonymous> (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/templates.js:14:24)",
    " at ListenerCollection.fire (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/listenerCollection.js:157:32)",
    " at async beforeRender (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:24:5)",
    " at async WorkerReporter._render (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:147:7)",
    " at async /opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/reporter.js:227:24",
    " at async processAndResponse (/opt/nodejs/node_modules/@jsreport/advanced-workers/lib/workerHandler.js:41:17)"
    ]
    }

    2024-05-08T16:27:52.360Z cd88a1a0-8c28-42a4-b0e2-bcdb8cfa8110 ERROR Invoke Error {"errorType":"Error","errorMessage":"Template must contains _id, name, shortid or content attribute","weak":true,"statusCode":400,"logged":true,"previousOperationId":"la4p6e1b8wvas12","stack":["Error: Template must contains _id, name, shortid or content attribute"," at module.exports (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)"," at WorkerReporter.createError (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:53:12)"," at AsyncFunction.<anonymous> (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/templates.js:14:24)"," at ListenerCollection.fire (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/listenerCollection.js:157:32)"," at async beforeRender (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:24:5)"," at async WorkerReporter._render (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:147:7)"," at async /opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/reporter.js:227:24"," at async processAndResponse (/opt/nodejs/node_modules/@jsreport/advanced-workers/lib/workerHandler.js:41:17)"]}
    2024-05-08T12:27:52.362-04:00
    END RequestId: cd88a1a0-8c28-42a4-b0e2-bcdb8cfa8110

    END RequestId: cd88a1a0-8c28-42a4-b0e2-bcdb8cfa8110
    2024-05-08T12:27:52.362-04:00
    REPORT RequestId: cd88a1a0-8c28-42a4-b0e2-bcdb8cfa8110 Duration: 503.85 ms Billed Duration: 504 ms Memory Size: 1024 MB Max Memory Used: 634 MB

    REPORT RequestId: cd88a1a0-8c28-42a4-b0e2-bcdb8cfa8110 Duration: 503.85 ms Billed Duration: 504 ms Memory Size: 1024 MB Max Memory Used: 634 MB
    2024-05-08T12:30:16.186-04:00
    START RequestId: dbef8192-16f6-4a68-850f-6119cbad0f97 Version: $LATEST

    START RequestId: dbef8192-16f6-4a68-850f-6119cbad0f97 Version: $LATEST
    2024-05-08T12:30:16.274-04:00
    2024-05-08T16:30:16.274Z dbef8192-16f6-4a68-850f-6119cbad0f97 INFO handling event

    2024-05-08T16:30:16.274Z dbef8192-16f6-4a68-850f-6119cbad0f97 INFO handling event
    2024-05-08T12:30:16.312-04:00
    2024-05-08T16:30:16.312Z - debug: fs journal was not synced for a while, need full reload

    2024-05-08T16:30:16.312Z - debug: fs journal was not synced for a while, need full reload
    2024-05-08T12:30:16.312-04:00
    2024-05-08T16:30:16.312Z - info: fs store is loading data

    2024-05-08T16:30:16.312Z - info: fs store is loading data
    2024-05-08T12:30:16.332-04:00
    2024-05-08T16:30:16.332Z - info: Render request 3 queued for execution and waiting for available worker rootId=n8f3ig2d7sa55e2, id=n8f3ig2d7sa55e2

    2024-05-08T16:30:16.332Z - info: Render request 3 queued for execution and waiting for available worker rootId=n8f3ig2d7sa55e2, id=n8f3ig2d7sa55e2
    2024-05-08T12:30:16.493-04:00
    2024-05-08T16:30:16.493Z - info: Starting rendering request 3 rootId=n8f3ig2d7sa55e2, id=n8f3ig2d7sa55e2

    2024-05-08T16:30:16.493Z - info: Starting rendering request 3 rootId=n8f3ig2d7sa55e2, id=n8f3ig2d7sa55e2
    2024-05-08T12:30:16.493-04:00
    2024-05-08T16:30:16.493Z - warn: Error when processing render request 3

    2024-05-08T16:30:16.493Z - warn: Error when processing render request 3
    2024-05-08T12:30:16.493-04:00
    (because) template must contains _id, name, shortid or content attribute

    (because) template must contains _id, name, shortid or content attribute
    2024-05-08T12:30:16.493-04:00
    Error: Template must contains _id, name, shortid or content attribute

    Error: Template must contains _id, name, shortid or content attribute
    2024-05-08T12:30:16.493-04:00
    at module.exports (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)

    at module.exports (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)
    2024-05-08T12:30:16.493-04:00
    at WorkerReporter.createError (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:53:12)

    at WorkerReporter.createError (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:53:12)
    2024-05-08T12:30:16.493-04:00
    at AsyncFunction.<anonymous> (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/templates.js:14:24)

    at AsyncFunction.<anonymous> (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/templates.js:14:24)
    2024-05-08T12:30:16.493-04:00
    at ListenerCollection.fire (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/listenerCollection.js:157:32)

    at ListenerCollection.fire (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/listenerCollection.js:157:32)
    2024-05-08T12:30:16.493-04:00
    at async beforeRender (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:24:5)

    at async beforeRender (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:24:5)
    2024-05-08T12:30:16.493-04:00
    at async WorkerReporter._render (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:147:7)

    at async WorkerReporter._render (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:147:7)
    2024-05-08T12:30:16.493-04:00
    at async /opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/reporter.js:227:24

    at async /opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/reporter.js:227:24
    2024-05-08T12:30:16.493-04:00
    at async processAndResponse (/opt/nodejs/node_modules/@jsreport/advanced-workers/lib/workerHandler.js:41:17) rootId=n8f3ig2d7sa55e2, id=n8f3ig2d7sa55e2

    at async processAndResponse (/opt/nodejs/node_modules/@jsreport/advanced-workers/lib/workerHandler.js:41:17) rootId=n8f3ig2d7sa55e2, id=n8f3ig2d7sa55e2
    2024-05-08T12:30:16.493-04:00
    2024-05-08T16:30:16.493Z - warn: Rendering request 3 finished with error in 218 ms rootId=n8f3ig2d7sa55e2, id=n8f3ig2d7sa55e2

    2024-05-08T16:30:16.493Z - warn: Rendering request 3 finished with error in 218 ms rootId=n8f3ig2d7sa55e2, id=n8f3ig2d7sa55e2
    2024-05-08T12:30:16.494-04:00
    2024-05-08T16:30:16.494Z dbef8192-16f6-4a68-850f-6119cbad0f97 ERROR Invoke Error
    {
    "errorType": "Error",
    "errorMessage": "Template must contains _id, name, shortid or content attribute",
    "weak": true,
    "statusCode": 400,
    "logged": true,
    "previousOperationId": "ewptwsqrvuco7lm",
    "stack": [
    "Error: Template must contains _id, name, shortid or content attribute",
    " at module.exports (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)",
    " at WorkerReporter.createError (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:53:12)",
    " at AsyncFunction.<anonymous> (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/templates.js:14:24)",
    " at ListenerCollection.fire (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/listenerCollection.js:157:32)",
    " at async beforeRender (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:24:5)",
    " at async WorkerReporter._render (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:147:7)",
    " at async /opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/reporter.js:227:24",
    " at async processAndResponse (/opt/nodejs/node_modules/@jsreport/advanced-workers/lib/workerHandler.js:41:17)"
    ]
    }

    2024-05-08T16:30:16.494Z dbef8192-16f6-4a68-850f-6119cbad0f97 ERROR Invoke Error {"errorType":"Error","errorMessage":"Template must contains _id, name, shortid or content attribute","weak":true,"statusCode":400,"logged":true,"previousOperationId":"ewptwsqrvuco7lm","stack":["Error: Template must contains _id, name, shortid or content attribute"," at module.exports (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)"," at WorkerReporter.createError (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:53:12)"," at AsyncFunction.<anonymous> (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/templates.js:14:24)"," at ListenerCollection.fire (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/shared/listenerCollection.js:157:32)"," at async beforeRender (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:24:5)"," at async WorkerReporter._render (/opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:147:7)"," at async /opt/nodejs/node_modules/@jsreport/jsreport-core/lib/worker/reporter.js:227:24"," at async processAndResponse (/opt/nodejs/node_modules/@jsreport/advanced-workers/lib/workerHandler.js:41:17)"]}
    2024-05-08T12:30:16.495-04:00
    END RequestId: dbef8192-16f6-4a68-850f-6119cbad0f97

    END RequestId: dbef8192-16f6-4a68-850f-6119cbad0f97
    2024-05-08T12:30:16.495-04:00
    REPORT RequestId: dbef8192-16f6-4a68-850f-6119cbad0f97 Duration: 309.21 ms Billed Duration: 310 ms Memory Size: 1024 MB Max Memory Used: 634 MB

    REPORT RequestId: dbef8192-16f6-4a68-850f-6119cbad0f97 Duration: 309.21 ms Billed Duration: 310 ms Memory Size: 1024 MB Max Memory Used: 634 MB
    2024-05-08T12:36:50.831-04:00
    2024-05-08T16:36:50.828Z - warn: Failed persist profile Timeout during waiting for file system, try it again later. stack=Error: Timeout during waiting for file system, try it again later.

    2024-05-08T16:36:50.828Z - warn: Failed persist profile Timeout during waiting for file system, try it again later. stack=Error: Timeout during waiting for file system, try it again later.
    2024-05-08T12:36:50.831-04:00
    at Object.rejectItemsWithTimeout (/opt/nodejs/node_modules/@jsreport/jsreport-fs-store/lib/queue.js:52:23)

    at Object.rejectItemsWithTimeout (/opt/nodejs/node_modules/@jsreport/jsreport-fs-store/lib/queue.js:52:23)
    2024-05-08T12:36:50.831-04:00
    at Timeout._onTimeout (/opt/nodejs/node_modules/@jsreport/jsreport-fs-store/lib/transaction.js:31:11)

    at Timeout._onTimeout (/opt/nodejs/node_modules/@jsreport/jsreport-fs-store/lib/transaction.js:31:11)
    2024-05-08T12:36:50.831-04:00
    at listOnTimeout (node:internal/timers:569:17)

    at listOnTimeout (node:internal/timers:569:17)
    2024-05-08T12:36:50.831-04:00
    at process.processTimers (node:internal/timers:512:7)

    at process.processTimers (node:internal/timers:512:7)



  • Here is the request format we're using:
    {
    "renderRequest": {
    "template": {
    "shortid": "XXXID",
    "engine": "handlebars",
    "name": "XXXXName",
    "recipe": "chrome-pdf"
    },
    "data": {
    [....]
    },
    "options": {
    "reports": {
    "save": true
    },
    "toc": true
    }
    }
    }



  • I thought the error popped up because of the use of the reports extension but seems like it isn't the case as I am not able to replicate the issue.

    Could you please try to follow our tutorial again in a new function
    https://jsreport.net/learn/aws-lambda-serverless
    And then test the similar calls you do

    {
      "renderRequest": {
        "template": {
          "name": "invoice-main"
        },
        "options": {
            "reports": {
                "save": true
            }
        }
      }
    }
    

    Does this also cause autocleanup errors? What do you do differently?


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.