onflow / flow-interaction-template-service

https://flix.flow.com
Apache License 2.0
11 stars 4 forks source link

Problems with running server locally #29

Open bartolomej opened 7 months ago

bartolomej commented 7 months ago

Current Behavior

I've noticed a few issues when I tried to setup and run this project.

  1. Invalid default MIGRATION_PATH setting

When you run the start command (which sets the current working directory to ./api), I get this error:

[Error: ENOENT: no such file or directory, scandir '/Users/bartkozorog/Projects/flow-interaction-template-service/dist/migrations'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: '/Users/bartkozorog/Projects/flow-interaction-template-service/dist/migrations'
}

This seems to be caused by this setting: MIGRATION_PATH=../dist/migrations. This should probably be MIGRATION_PATH=./dist/migrations (without .. part) instead.

  1. Invalid default TEMPLATE_DIR setting

The default glob pattern used (../templates) is also returning directories. These directory paths are then passed to fs.readFile, which doesn't seem to accept directories, given that it throws:

[Error: EISDIR: illegal operation on a directory, read] {
  errno: -21,
  code: 'EISDIR',
  syscall: 'read'
}

I believe the default setting here should be TEMPLATE_DIR=../templates/**/*.json, which returns all JSON files in subdirectories.

Expected Behavior

Explained above.

Steps To Reproduce

Do a clean project setup (e.g. by cloning the repo and running npm i) and try running it.

Environment

- Node: v16.7.0
- npm: 7.20.3

What are you currently working on that this is blocking?

I'm playing around with this project a bit, to see if we can extend it to support use cases mentioned here: https://github.com/onflow/flow-interaction-template-service/issues/18#issuecomment-1793447788