diff --git a/.changeset/tidy-snails-smile.md b/.changeset/tidy-snails-smile.md new file mode 100644 index 0000000000000..546ec86bd8e63 --- /dev/null +++ b/.changeset/tidy-snails-smile.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/apps": patch +--- + +Fixes app startup failing with EACCES errors in docker deployments running with specified UIDs diff --git a/packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts b/packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts index 430185a94ca77..8641bdcabe73a 100644 --- a/packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts +++ b/packages/apps/src/server/runtime/deno/AppsEngineDenoRuntime.ts @@ -25,7 +25,7 @@ function getDenoConfigPath(): string { * * Returns the path to the generated config file. */ -function generateEphemeralDenoConfig(targetPath: string, denoConfigPath: string, appsEnginePath: string): void { +function generateEphemeralDenoConfig(targetPath: string, denoConfigPath: string, appsEnginePath: string, packagePath: string): void { let staticConfig: DenoConfigurationFileSchema; try { @@ -39,6 +39,8 @@ function generateEphemeralDenoConfig(targetPath: string, denoConfigPath: string, imports: { ...staticConfig.imports, '@rocket.chat/apps-engine/': `${appsEnginePath}/`, + '@rocket.chat/apps/base-runtime/': `${path.join(packagePath, 'base-runtime', 'src')}/`, + '@rocket.chat/apps/': `${packagePath}/`, }, }; @@ -67,7 +69,7 @@ export class DenoRuntimeSubprocessController extends BaseRuntimeSubprocessContro this.denoDir = process.env.DENO_DIR ?? path.join(this.packagePath, '.deno-cache'); this.denoRuntimePath = path.join(this.tempFilePath, 'deno-runtime', 'main.ts'); - this.denoEphemeralConfigPath = this.denoConfigPath.replace('.jsonc', '.runtime.jsonc'); + this.denoEphemeralConfigPath = path.join(this.tempFilePath, 'deno.runtime.jsonc'); /** * Deno 2.x refuses to run scripts inside the node_modules, so we create a symlink to the deno runtime files in the temp directory @@ -81,8 +83,8 @@ export class DenoRuntimeSubprocessController extends BaseRuntimeSubprocessContro } } - // Generate a runtime config with the resolved absolute path for @rocket.chat/apps-engine/ - generateEphemeralDenoConfig(this.denoEphemeralConfigPath, this.denoConfigPath, this.appsEnginePath); + // Generate a runtime config with the resolved absolute path for @rocket.chat/apps-engine/ and @rocket.chat/apps/ paths + generateEphemeralDenoConfig(this.denoEphemeralConfigPath, this.denoConfigPath, this.appsEnginePath, this.packagePath); } protected buildProcessConfiguration(): ProcessConfiguration {