Hi, you are installing Self-hosted Retool Service on AWS using Docker Compose with Terraform.
During the installation, errors were found in the service: tapi-dev-backoffice-retool-main-service
Log:
message
not untarring the bundle
sed: can't read ./dist/mobile/.js: No such file or directory
{"level":"info","message":"[process service types] JOBS_RUNNER","timestamp":"2024-05-28T14:13:24.597Z"}
'"---------------------------"
'"- EXITING RETOOL -"
'"---------------------------"
Error running database migrations: TypeError: Cannot read properties of undefined (reading 'use_env_variable')
not untarring the bundle
sed: can't read ./dist/mobile/.js: No such file or directory
{"level":"info","message":"[process service types] JOBS_RUNNER","timestamp":"2024-05-28T14:15:41.770Z"}
'"---------------------------"
'"- EXITING RETOOL -"
'"---------------------------"
Error running database migrations: TypeError: Cannot read properties of undefined (reading 'use_env_variable')
not untarring the bundle
sed: can't read ./dist/mobile/.js: No such file or directory
{"level":"info","message":"[process service types] JOBS_RUNNER","timestamp":"2024-05-28T14:18:17.305Z"}
'"---------------------------"
'"- EXITING RETOOL -"
'"---------------------------"
Error running database migrations: TypeError: Cannot read properties of undefined (reading 'use_env_variable')
not untarring the bundle
sed: can't read ./dist/mobile/.js: No such file or directory
{"level":"info","message":"[process service types] JOBS_RUNNER","timestamp":"2024-05-28T14:20:43.702Z"}
'"---------------------------"
'"- EXITING RETOOL -"
'"---------------------------"
Error running database migrations: TypeError: Cannot read properties of undefined (reading 'use_env_variable')
not untarring the bundle
sed: can't read ./dist/mobile/.js: No such file or directory
{"level":"info","message":"[process service types] JOBS_RUNNER","timestamp":"2024-05-28T14:22:59.558Z"}
'"---------------------------"
'"- EXITING RETOOL -"
'"---------------------------"
Error running database migrations: TypeError: Cannot read properties of undefined (reading 'use_env_variable')
not untarring the bundle
sed: can't read ./dist/mobile/.js: No such file or directory
{"level":"info","message":"[process service types] MAIN_BACKEND, DB_CONNECTOR, DB_SSH_CONNECTOR","timestamp":"2024-05-28T20:19:34.737Z"}
Failing checking database migrations
/retool_backend/bundle/main.js:32
);ev0=!0}}function sD(){let e=O60.default.scope().active()?.context().toTraceId();if(e)return D60.get(e)||0}function NW(){let e=O60.default.scope().active()?.context().toTraceId();if(e){let t=D60.get(e)||0;D60.set(e,t+1||1)}}var O60,rv0,P60,rV1,en,ZE0,ev0,D60,tv0,Nm,Wc=g(()=>{"use strict";O60=h(require("dd-trace")),rv0=h(require("lru-cache")),P60=require("sequelize");F();rV1=b("NODE_ENV")||"development",en=_W()[rV1],ZE0="POSTGRES_CUSTOM_SSL_CERT_PATH & POSTGRES_CUSTOM_SSL_CA_FILE_NAME (and optionally POSTGRES_CUSTOM_SSL_CERT_FILE_NAME & POSTGRES_CUSTOM_SSL_KEY_FILE_NAME) \u2014 see https://docs.retool.com/docs/environment-variables",ev0=!1;D60=new rv0.default({max:100,ttl:10*60*1e3});tv0={beforeFind:e=>{NW()},beforeSave:(e,t)=>{NW()},beforeUpdate:(e,t)=>{NW()},beforeDestroy:(e,t)=>{NW()}};Nm=()=>en.use_env_variable?new P60.Sequelize(String(process.env[en.use_env_variable]),{logging:en.logging,dialectOptions:en.dialectOptions,hooks:tv0}):new P60.Sequelize(en.database,en.username,en.password,{...en,hooks:tv0})});var av0={};l0(av0,{executeMigrations:()=>nv0,exitIfPendingMigrations:()=>aV1,pendingDatabaseMigrations:()=>Rh,runMigrations:()=>sV1});function oV1(){let e=N60.join(__dirname,"../migrations"),t=N60.join(__dirname,"./migrations");return!_60.default.existsSync(e)&&_60.default.existsSync(t)?t:e}function ov0(e){let t=r=>{process.env.NODE_ENV!=="test"&&console.log(r)};return new UW.Umzug({migrations:{glob:
${oV1()}/.js,resolve:({name:r,path:o,context:n})=>{let a=require(o);return{name:r,up:async()=>a.up(...n),down:async()=>a.down(...n)}}},context:[e.getQueryInterface(),BW.Sequelize],storage:new UW.SequelizeStorage({sequelize:e}),logger:{info:t,debug:t,warn:t,error:r=>{process.env.NODE_ENV!=="test"&&console.error(r)}}})}async function nv0(){let e=Nm(),t=ov0(e),r=0;try{for(;await Rh(e)!==0&&(b("DISABLE_DATABASE_MIGRATIONS_TIMEOUT")||r<iD);){let n=!1,a;try{console.log("Acquiring lock to run migrations..."),a=await e.transaction(),(await e.query(
SELECT pg_try_advisory_xact_lock(${nV1}) AS migration_lock_result,{type:BW.QueryTypes.SELECT,transaction:a}))[0].migration_lock_result?(console.log("Acquired lock"),await Rh(e)===0?console.log("Releasing lock... no migrations to run"):(console.log("Running database migrations..."),await t.up())):(console.log(
Could not acquire lock, retrying in ${VS/1e3} second(s)...),n=!0)}finally{a&&await a.commit(),n&&(r+=1,await new Promise(s=>setTimeout(s,VS)))}}let o=await Rh(e);if(o===0){console.log("Database migrations are up to date.");return}if(!b("DISABLE_DATABASE_MIGRATIONS_TIMEOUT")&&r>=iD){console.error(
Could not acquire lock after ${iD} attempts at ${VS/1e3} second intervals.),console.error(
There ${o>1?"are":"is"} ${o} pending database ${o>1?"migrations":"migration"}. If you are running multiple containers, another container has acquired the lock and is still running migrations... After it completes, please restart this container.);return}}finally{e&&await e.close()}}async function Rh(e){let t;try{return t=e||Nm(),b("RETOOL_HOSTED")||await x60(t),(await ov0(t).pending()).length}catch(r){throw console.error("Failing checking database migrations"),r}finally{!e&&t&&await t.close()}}async function aV1(e){let t=0,r=0;for(;b("DISABLE_DATABASE_MIGRATIONS_TIMEOUT")||t<iD;)if(r=await Rh(e),r===0){console.log("Database migrations are up to date.");return}else console.log(
There ${r>1?"are":"is"} ${r} pending database ${r>1?"migrations":"migration"}, checking for up-to-date schema in ${VS/1e3} second(s). If this message persists, ensure that Jobs Runner is up and is running a matching image version.),t+=1,await new Promise(o=>setTimeout(o,VS));!b("DISABLE_DATABASE_MIGRATIONS_TIMEOUT")&&t>=iD&&(console.error(
^
TypeError: Cannot read properties of undefined (reading 'use_env_variable')
at Nm (/retool_backend/bundle/main.js:32:812)
at Rh (/retool_backend/bundle/main.js:32:3010)
at aV1 (/retool_backend/bundle/main.js:32:3281)
at wY2 (/retool_backend/bundle/main.js:4155:3864)
at Object. (/retool_backend/bundle/main.js:4155:4729)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
Node.js v18.18.2
not untarring the bundle
sed: can't read ./dist/mobile/.js: No such file or directory
{"level":"info","message":"[process service types] MAIN_BACKEND, DB_CONNECTOR, DB_SSH_CONNECTOR","timestamp":"2024-05-28T20:21:01.903Z"}
Failing checking database migrations
/retool_backend/bundle/main.js:32
);ev0=!0}}function sD(){let e=O60.default.scope().active()?.context().toTraceId();if(e)return D60.get(e)||0}function NW(){let e=O60.default.scope().active()?.context().toTraceId();if(e){let t=D60.get(e)||0;D60.set(e,t+1||1)}}var O60,rv0,P60,rV1,en,ZE0,ev0,D60,tv0,Nm,Wc=g(()=>{"use strict";O60=h(require("dd-trace")),rv0=h(require("lru-cache")),P60=require("sequelize");F();rV1=b("NODE_ENV")||"development",en=_W()[rV1],ZE0="POSTGRES_CUSTOM_SSL_CERT_PATH & POSTGRES_CUSTOM_SSL_CA_FILE_NAME (and optionally POSTGRES_CUSTOM_SSL_CERT_FILE_NAME & POSTGRES_CUSTOM_SSL_KEY_FILE_NAME) \u2014 see https://docs.retool.com/docs/environment-variables",ev0=!1;D60=new rv0.default({max:100,ttl:10*60*1e3});tv0={beforeFind:e=>{NW()},beforeSave:(e,t)=>{NW()},beforeUpdate:(e,t)=>{NW()},beforeDestroy:(e,t)=>{NW()}};Nm=()=>en.use_env_variable?new P60.Sequelize(String(process.env[en.use_env_variable]),{logging:en.logging,dialectOptions:en.dialectOptions,hooks:tv0}):new P60.Sequelize(en.database,en.username,en.password,{...en,hooks:tv0})});var av0={};l0(av0,{executeMigrations:()=>nv0,exitIfPendingMigrations:()=>aV1,pendingDatabaseMigrations:()=>Rh,runMigrations:()=>sV1});function oV1(){let e=N60.join(__dirname,"../migrations"),t=N60.join(__dirname,"./migrations");return!_60.default.existsSync(e)&&_60.default.existsSync(t)?t:e}function ov0(e){let t=r=>{process.env.NODE_ENV!=="test"&&console.log(r)};return new UW.Umzug({migrations:{glob:
${oV1()}/*.js,resolve:({name:r,path:o,context:n})=>{let a=require(o);return{name:r,up:async()=>a.up(...n),down:async()=>a.down(...n)}}},context:[e.getQueryInterface(),BW.Sequelize],storage:new UW.SequelizeStorage({sequelize:e}),logger:{info:t,debug:t,warn:t,error:r=>{process.env.NODE_ENV!=="test"&&console.error(r)}}})}async function nv0(){let e=Nm(),t=ov0(e),r=0;try{for(;await Rh(e)!==0&&(b("DISABLE_DATABASE_MIGRATIONS_TIMEOUT")||r<iD);){let n=!1,a;try{console.log("Acquiring lock to run migrations..."),a=await e.transaction(),(await e.query(
SELECT pg_try_advisory_xact_lock(${nV1}) AS migration_lock_result,{type:BW.QueryTypes.SELECT,transaction:a}))[0].migration_lock_result?(console.log("Acquired lock"),await Rh(e)===0?console.log("Releasing lock... no migrations to run"):(console.log("Running database migrations..."),await t.up())):(console.log(
Could not acquire lock, retrying in ${VS/1e3} second(s)...),n=!0)}finally{a&&await a.commit(),n&&(r+=1,await new Promise(s=>setTimeout(s,VS)))}}let o=await Rh(e);if(o===0){console.log("Database migrations are up to date.");return}if(!b("DISABLE_DATABASE_MIGRATIONS_TIMEOUT")&&r>=iD){console.error(
Could not acquire lock after ${iD} attempts at ${VS/1e3} second intervals.),console.error(
There ${o>1?"are":"is"} ${o} pending database ${o>1?"migrations":"migration"}. If you are running multiple containers, another container has acquired the lock and is still running migrations... After it completes, please restart this container.);return}}finally{e&&await e.close()}}async function Rh(e){let t;try{return t=e||Nm(),b("RETOOL_HOSTED")||await x60(t),(await ov0(t).pending()).length}catch(r){throw console.error("Failing checking database migrations"),r}finally{!e&&t&&await t.close()}}async function aV1(e){let t=0,r=0;for(;b("DISABLE_DATABASE_MIGRATIONS_TIMEOUT")||t<iD;)if(r=await Rh(e),r===0){console.log("Database migrations are up to date.");return}else console.log(
There ${r>1?"are":"is"} ${r} pending database ${r>1?"migrations":"migration"}, checking for up-to-date schema in ${VS/1e3} second(s). If this message persists, ensure that Jobs Runner is up and is running a matching image version.),t+=1,await new Promise(o=>setTimeout(o,VS));!b("DISABLE_DATABASE_MIGRATIONS_TIMEOUT")&&t>=iD&&(console.error(
TypeError: Cannot read properties of undefined (reading 'use_env_variable')
at Nm (/retool_backend/bundle/main.js:32:812)
at Rh (/retool_backend/bundle/main.js:32:3010)
at aV1 (/retool_backend/bundle/main.js:32:3281)
at wY2 (/retool_backend/bundle/main.js:4155:3864)
at Object. (/retool_backend/bundle/main.js:4155:4729)