Lambda deploy "message": "EROFS: read-only file system, mkdir '/var/task/logs'"



  • How to disable LOGS?

    My code

    import request from 'request'
    
    const chromium = require('chrome-aws-lambda')
    const JsReport = require('jsreport')
    
    const promisify = require('util').promisify
    const ncp = promisify(require('ncp'))
    const path = require('path')
    const fs = require('fs')
    const AWS = require('aws-sdk')
    
    export default async(_, {event}, ctx) =>{
    	let jsreport
    
    
    	const init = (async () => { 
    		jsreport = await JsReport({
    			//configFile: path.join(__dirname, './prod.config.json'),        
    			chrome: {
    				launchOptions: {
    					args: chromium.args,
    					defaultViewport: chromium.defaultViewport,
    					executablePath: await chromium.executablePath,
    					headless: true,
    				}         
    			},
    			
    			'store': {
    				'provider': 'fs'
    			},
    			'blobStorage': {
    				'provider': 'fs'
    			},
    			'tasks': {
    				'allowedModules':'*',
    				'strategy': 'in-process'
    			},
    			'loadConfig': false,
    			logger: {
    				enabled: false,
    				silent: true
    			},
    			'studio': { 'enabled': false },
    			'allowLocalFilesAccess': false,
    			'reportTimeout': 60000,
    			'templatingEngines': {
    				'strategy': 'http-server'
    			},
    			'extensions': {
    				'express': {
    					'enabled': false
    				},
    				'scripts': {
    					'strategy': 'http-server'
    				},'studio': {
    
    					'requestLogEnabled': false
    
    				},
    
    			},
    			
    			
    
    		})
    		//await ncp(path.join(__dirname, './data'), './tmp/data')
    		return jsreport.init()
    
    	})()
    	const body = {
    		'template': {
    			'name': 'invoice-main',
    			'recipe': 'chrome-pdf'
    		},
    		'data': {
    			'data':[
    				{
    					'customerNr': 1,
    					'salutation': 2,
    					'nameCustomer': 2,
    					'additive': 2,
    					'street': 2,
    					'postCode': 2,
    					'city': 3333
    				}
    			]
    		}
    	}
    	await init
    	const res = await jsreport.render(body)
    	
    
    	return({
    		statusCode: 200,
    		body: null,
    	}) }
    

    my package.json

    {
      "name": "reports",
      "version": "1.0.0",
      "description": "",
      "scripts": {
        "start": "sls offline start",
        "deploy": "sls deploy",
        "jsreport": "jsreport"
      },
      "dependencies": {
      },
      "jsreport": {
        "entryPoint": "server.js"
      },
      "devDependencies": {
        "jsreport": "^2.10.0",
        "puppeteer": "^1.11.0",
        "aws-sdk": "^2.544.0",
        "serverless-offline-direct-lambda": "^0.0.1",
        "@apollo/federation": "^0.12.1",
        "apollo-server-lambda": "^2.10.0",
        "archiver": "3.0.0",
        "chrome-aws-lambda": "2.0.2",
        "dataloader-sequelize": "^2.0.0",
        "dateformat": "^3.0.3",
        "graphql-iso-date": "^3.6.1",
        "graphql-type-json": "^0.3.1",
        "ioredis": "^4.14.1",
        "jsonwebtoken": "^8.5.1",
        "jwk-to-pem": "^2.0.1",
        "modclean": "^3.0.0-beta.1",
        "mysql2": "^2.2.5",
        "ncp": "2.0.0",
        "request": "^2.88.0",
        "rimraf": "3.0.1",
        "sequelize": "^5.19.0",
        "source-map-support": "^0.5.16"
      },
      "author": "",
      "license": "ISC"
    }
    
    


  • EROR

    [
                            "Error: EROFS: read-only file system, mkdir '/var/task/logs'",
                            "    at Object.mkdirSync (fs.js:757:3)",
                            "    at Function.sync (/opt/nodejs/node_modules/mkdirp/index.js:72:13)",
                            "    at addTransports (/opt/nodejs/node_modules/jsreport/lib/extendConfig.js:50:12)",
                            "    at Reporter.module.exports [as _fnAfterConfigLoaded] (/opt/nodejs/node_modules/jsreport/lib/extendConfig.js:55:3)",
                            "    at Reporter._initOptions (/opt/nodejs/node_modules/jsreport-core/lib/reporter.js:389:16)"
                        ]
    


  • Hi,

    have you seen our tutorial for running jsreport in AWS Lambda?
    These things are covered there
    https://jsreport.net/learn/aws-lambda-serverless



  • Yes
    I do it according to the recommendations!
    But the error remains. Can you know why this error?



  • ncp(path.join(__dirname, './data'), './tmp/data') ->
    tmp for this?




Log in to reply
 

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