Skip to main content
Participant
August 25, 2023
Question

Issue running PDF SDK with Typescript on AWS Lambda functions

  • August 25, 2023
  • 1 reply
  • 992 views

I am running my app on Lambda function to generate PDF from Word document, however the code is not even starting, when called it goes trait with the following message:

| Error: allowedConfiguration is not defined

       at ../../../node_modules/.pnpm/@adobe+pdfservices-node-sdk@3.4.2/node_modules/@adobe/pdfservices-node-sdk/src/operation/export-pdf-to-images-operation.js (/Users/rdinis/IdeaProjects/mpi/trade-certification-main/node_modules/.pnpm/@adobe+pdfservices-node-sdk@3.4.2/node_modules/@adobe/pdfservices-node-sdk/src/operation/export-pdf-to-images-operation.js:77:1)

       at __require2 (file:///Users/rdinis/IdeaProjects/mpi/trade-certification-main/backend/service/pdf-generation/.sst/artifacts/c8bb0bcd321ec6f63b0c0aa4f72c285df9e6710a1a/src/functions/resolver.mjs:24:50)

       at ../../../node_modules/.pnpm/@adobe+pdfservices-node-sdk@3.4.2/node_modules/@adobe/pdfservices-node-sdk/src/pdfservices-sdk.js (/Users/rdinis/IdeaProjects/mpi/trade-certification-main/node_modules/.pnpm/@adobe+pdfservices-node-sdk@3.4.2/node_modules/@adobe/pdfservices-node-sdk/src/pdfservices-sdk.js:24:31)

       at __require2 (file:///Users/rdinis/IdeaProjects/mpi/trade-certification-main/backend/service/pdf-generation/.sst/artifacts/c8bb0bcd321ec6f63b0c0aa4f72c285df9e6710a1a/src/functions/resolver.mjs:24:50)

       at <anonymous> (/Users/rdinis/IdeaProjects/mpi/trade-certification-main/backend/service/pdf-generation/src/functions/createPDFFromTemplate.ts:1:69)

       at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

Can anyone explain that?

    This topic has been closed for replies.

    1 reply

    Raymond Camden
    Community Manager
    Community Manager
    August 25, 2023

    I know our SDK runs on Lambda - can you try _not_ using a TypeScript file, just to help minimize the issues? Also, since your using Node, you can easily use our REST APIs instead of the SDK. I even have a library (https://github.com/cfjedimaster/document-services-demos/tree/main/serviceswrapper) you could use to get you most of the way there.

    Participant
    November 10, 2023

    Seeing the same issue here in NextJs (node) environment. It's due to the allowedConfiguration object not being defined correctly in multiple files under src/operation/. I don't think saying "don't use the SDK" is really an answer, it's a pretty easy fix.

    Raymond Camden
    Community Manager
    Community Manager
    November 10, 2023

    Well, we don't specify support for TypeScript -but it you want to give me an exact report of what fails, I could report it internally. Officially, you would need to use JavaScript though. 

     

    Me saying 'dont use the SDK' was simply trying to give you an alternative to quickly get going again. Personally I've stopped using our SDKs since the REST APIs are so simple. I *know* that would work in a TypeScript environment.