Skip to main content
Participant
Aug 25, 2023 3:58 AM UTC
Question

Issue running PDF SDK with Typescript on AWS Lambda functions

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 is closed to new replies. Start a new post to keep the conversation going.

    4 replies

    Raymond Camden
    Community Manager
    Community Manager
    Aug 25, 2023 5:41 PM UTC

    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.

    Translate
    Participant
    Nov 10, 2023 10:22 AM UTC

    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.

    Translate
    Raymond Camden
    Community Manager
    Community Manager
    Nov 10, 2023 2:19 PM UTC

    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.

    Translate