dbos-inc / dbos-transact

The TypeScript framework for backends that scale
https://docs.dbos.dev
MIT License
335 stars 22 forks source link

config file entrypoints should be relative to config file location not current dir #399

Closed devhawk closed 3 months ago

devhawk commented 4 months ago

Problematic logic is: https://github.com/dbos-inc/dbos-transact/blob/29fef96f71cfd694d9abbb799963b73675b9f98f/src/dbos-runtime/runtime.ts#L67

kraftp commented 3 months ago

Can you go into more detail on why you think we should do this? process.cwd() is the application package root, which is the natural place to which paths should be relative in my opinion.

devhawk commented 3 months ago

cwd depends on user action, dbos-config file doesn't move very often. I ran into this when I was debugging transact but running an dbos application from another folder.

kraftp commented 3 months ago

Can you give an example? Transact also implicitly assumes the config file is at process.cwd, so I'm not sure how this change would help.

https://github.com/dbos-inc/dbos-transact/blob/397d295502c12e831addb8ca523a7a4da21b4f46/src/dbos-runtime/config.ts#L15 https://github.com/dbos-inc/dbos-transact/blob/397d295502c12e831addb8ca523a7a4da21b4f46/src/dbos-runtime/config.ts#L154

devhawk commented 3 months ago

When I am working on a new transact feature, I create a VSCode launch config to run a separate DBOS application. I specify the full path to the config file via the --configfile option. I used to also specify the entrypoint via the command line, but that option has now been replaced by specifying the entrypoints in the config file. So I have to hard code the full path in the config file so dbos start can find it

devhawk commented 3 months ago

If you specify a custom path to the dbos config file via --configfile option, how will dbos transact find the entrypoint files unless they've been hard coded in the config file?

qianl15 commented 3 months ago

If you implement a new Transact feature, I think normally it'd be fine to run an app in a different directory with a different version. However, if I understand it correctly, dbos start might not work if you implement some new features in decorators and want to use it in your app, because the original app is compiled with the old version of Transact.

devhawk commented 3 months ago

However, if I understand it correctly, dbos start might not work if you implement some new features in decorators and want to use it in your app, because the original app is compiled with the old version of Transact.

Yup, I've hit that. I've used a combination of building apps against a local transact package and casting to address this.

qianl15 commented 3 months ago

Close this issue as we now have a better way to support running apps in a different folder.