jsreport-fs-store-aws-s3-persistence plugin do not recognize AWS S3 credentials from environment variables



  • Hi guys!

    I'm trying to run JSReport with jsreport-fs-store-aws-s3-persistence plugin in a docker container.
    Content of my Dockerfile:

    FROM jsreport/jsreport:2.6.1
    
    RUN npm i jsreport-fs-store jsreport-fs-store-aws-s3-persistence --save
    
    COPY docker/configs/* /app/
    

    configs directory contains only 2 files jsreport.config.json and license-key.txt.

    Here is content of jsreport.config.json file:

    {
      "extensions": {
        "fs-store": {
          "persistence": {
            "provider": "aws-s3"
          },
          "compactionInterval": 20000
        },
        "fs-store-aws-s3-persistence": {
          "lock": {
            "queueName": "jsreport-lock.fifo"
          }
        },
        "chrome-pdf": {
          "timeout": 30000
        },
        "scripts": {
          "timeout": 40000,
          "strategy": "http-server"
        }
      },
      "httpPort": 5488,
      "store": {
        "provider": "fs"
      },
      "allowLocalFilesAccess": true,
      "templatingEngines": {
        "timeout": 10000,
        "strategy": "http-server"
      },
      "chrome": {
        "timeout": 40000
      }
    }
    

    Content of docker-compose.yml file:

    ---
    version: '3.7'
    services:
      jsreport:
        image: docker.company.com/jsreport
        container_name: jsreport
        restart: always
        ports:
          - "5488:5488"
        volumes:
          - jsreport:/jsreport
        environment:
          - extensions_authentication_admin_username=<username>
          - extensions_authentication_admin_password=<password>
          - extensions_authentication_cookieSession_secret=<secret>
          - extensions_fsStoreAwsS3Persistence_accessKeyId=<accessKeyId>
          - extensions_fsStoreAwsS3Persistence_secretAccessKey=<secretAccessKey>
          - extensions_fsStoreAwsS3Persistence_bucket=<bucket>
        tty: true
        stdin_open: true
    
    volumes:
      jsreport:
    

    When I run docker-compose up - I see the following output:

    jsreport    | nologin: this account is not available
    jsreport    | 2020-03-03T16:47:28.864Z - info: Initializing jsreport@2.6.1 in production mode using configuration file: jsreport.config.json
    jsreport    | 2020-03-03T16:47:28.867Z - info: Searching for available extensions in /app/
    jsreport    | 2020-03-03T16:47:28.880Z - info: Extensions location cache not found, crawling directories
    jsreport    | 2020-03-03T16:47:29.135Z - info: Found 37 extensions
    jsreport    | 2020-03-03T16:47:29.292Z - info: Setting http-server strategy for rendering
    jsreport    | 2020-03-03T16:47:29.405Z - info: Using extension authentication@2.3.0
    jsreport    | 2020-03-03T16:47:29.429Z - info: Using extension aws-s3-storage@1.0.0
    jsreport    | {}
    jsreport    | 2020-03-03T16:47:29.550Z - error: Error when loading extension aws-s3-storage@1.0.0
    jsreport    | Error: accessKeyId must be provided to jsreport-aws-s3-storage
    jsreport    |     at Object.module.exports (/app/node_modules/jsreport-aws-s3-storage/lib/main.js:15:11)
    jsreport    |     at Object._useOne (/app/node_modules/jsreport-core/lib/extensions/extensionsManager.js:194:75)
    jsreport    |     at Object._useMany (/app/node_modules/jsreport-core/lib/extensions/extensionsManager.js:98:20)
    jsreport    |     at processTicksAndRejections (internal/process/task_queues.js:93:5)
    jsreport    |     at async Reporter.init (/app/node_modules/jsreport-core/lib/reporter.js:209:7)
    jsreport    | 2020-03-03T16:47:29.556Z - error: Error occured during reporter init Error: Error when loading extension aws-s3-storage@1.0.0
    jsreport    | Error: accessKeyId must be provided to jsreport-aws-s3-storage
    jsreport    |     at Object.module.exports (/app/node_modules/jsreport-aws-s3-storage/lib/main.js:15:11)
    jsreport    |     at Object._useOne (/app/node_modules/jsreport-core/lib/extensions/extensionsManager.js:194:75)
    jsreport    |     at Object._useMany (/app/node_modules/jsreport-core/lib/extensions/extensionsManager.js:98:20)
    jsreport    |     at processTicksAndRejections (internal/process/task_queues.js:93:5)
    jsreport    |     at async Reporter.init (/app/node_modules/jsreport-core/lib/reporter.js:209:7)
    jsreport    |     at Object._useOne (/app/node_modules/jsreport-core/lib/extensions/extensionsManager.js:216:15)
    jsreport    |     at Object._useMany (/app/node_modules/jsreport-core/lib/extensions/extensionsManager.js:98:20)
    jsreport    |     at processTicksAndRejections (internal/process/task_queues.js:93:5)
    jsreport    |     at async Reporter.init (/app/node_modules/jsreport-core/lib/reporter.js:209:7)
    jsreport    | Error: Error when loading extension aws-s3-storage@1.0.0
    jsreport    | Error: accessKeyId must be provided to jsreport-aws-s3-storage
    jsreport    |     at Object.module.exports (/app/node_modules/jsreport-aws-s3-storage/lib/main.js:15:11)
    jsreport    |     at Object._useOne (/app/node_modules/jsreport-core/lib/extensions/extensionsManager.js:194:75)
    jsreport    |     at Object._useMany (/app/node_modules/jsreport-core/lib/extensions/extensionsManager.js:98:20)
    jsreport    |     at processTicksAndRejections (internal/process/task_queues.js:93:5)
    jsreport    |     at async Reporter.init (/app/node_modules/jsreport-core/lib/reporter.js:209:7)
    jsreport    |     at Object._useOne (/app/node_modules/jsreport-core/lib/extensions/extensionsManager.js:216:15)
    jsreport    |     at Object._useMany (/app/node_modules/jsreport-core/lib/extensions/extensionsManager.js:98:20)
    jsreport    |     at processTicksAndRejections (internal/process/task_queues.js:93:5)
    jsreport    |     at async Reporter.init (/app/node_modules/jsreport-core/lib/reporter.js:209:7)
    

    Passing AWS S3 credentials through jsreport.config.json file is not allowed by the security policy in my company.

    Can you please help me understand how to fix/bypass this issue?
    Thanks!


  • administrators

    hi! is not the error coming actually from jsreport-aws-s3-storage? so it seems you also need:

    - extensions_awsS3Storage_accessKeyId=<accessKeyId>
    - extensions_awsS3Storage_secretAccessKey=<secretAccessKey>
    - extensions_awsS3Storage_bucket=<bucket>
    


  • @bjrmatos thank you!

    I was able to find out the root cause of the issue.
    Long story short - we used old docker image with jsreport-aws-s3-storage plugin which is not used anymore. With a new docker image everything works well.


Log in to reply
 

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