#npm package/config only in scratch

1 messages · Page 1 of 1 (latest)

obtuse portal
#

How are you adding the config folder to the container and how are you running the npm process?

buoyant turtle
#

I'm not, I've installed config as a dependency inside the dagger project and am importing it directly in the dagger module.

obtuse portal
#

I don't think I follow. Trying to understand the difference between "dagger project" and "dagger module". Could you post your code?

buoyant turtle
#

@obtuse portal here's an example project.

Essentially I've created a boilerplate Dagger project with dagger init --sdk=typescript.

I've then installed the config npm module with yarn add --save config.

I'm then importing that module and making use of it in in the Dagger project in index.ts.
https://github.com/jshbrntt/dagger-example/blob/main/src/index.ts#L18-L26

When the config module tries to load the files in the ./config/ directory, it fails and you get the following error message.

dagger call container-echo
✔ connect 0.3s
✔ load module 6.7s
✔ parsing command line arguments 0.0s

✔ daggerExample: DaggerExample! 0.0s
✘ .containerEcho: Container! 1.6s
┃ WARNING: No configurations found in configuration directory:/scratch/config
┃ WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
┃ default value 'config.get("greeting")' at /src/src/index.ts:25:36 cannot be resolved, dagger does not support object or function as default value.
┃           The value will be ignored by the introspection and resolve at the runtime.
┃ Error: Configuration property "greeting" is not defined
! process "tsx --no-deprecation --tsconfig /src/tsconfig.json /src/src/__dagger.entrypoint.ts" did not complete successfully: exit code: 1

Error logs:

✘ .containerEcho: Container! 1.6s
WARNING: No configurations found in configuration directory:/scratch/config
WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
default value 'config.get("greeting")' at /src/src/index.ts:25:36 cannot be resolved, dagger does not support object or function as default value.
          The value will be ignored by the introspection and resolve at the runtime.
Error: Configuration property "greeting" is not defined
! process "tsx --no-deprecation --tsconfig /src/tsconfig.json /src/src/__dagger.entrypoint.ts" did not complete successfully: exit code: 1
obtuse portal
#

I wonder if it's a naming conflict based on the following. @brazen zinc thoughts?

┃ default value 'config.get("greeting")' at /src/src/index.ts:25:36 cannot be resolved, dagger does not support object or function as default value.

brazen zinc
#

Hmmm are you exposing the type of that package in your module?

#

Oh yeah, as a default value

#

If you have a prototype like foo(a: string = config.get("greeting"), it cannot work as it's explained in the error message.

 dagger does not support object or function as default value.