Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api-server): runtime plugin imports #346

Closed
petermetz opened this issue Nov 4, 2020 · 0 comments
Closed

fix(api-server): runtime plugin imports #346

petermetz opened this issue Nov 4, 2020 · 0 comments
Labels
API_Server bug Something isn't working
Milestone

Comments

@petermetz
Copy link
Contributor

Describe the bug

Currently the only way to use plugins in the API server is by injecting them via code that one has to actually write instead of just providing a declarative config file stating which plugins should be imported.

This fix is not possible until webpack/webpack#11316 gets merged and released.

In theory the changes to apply the fix are already part of the v0.2.0 release, but this issue has to stay open until we confirm the effectiveness of the fix via automated tests as well. (which also means that to close this, said tests have to be added also).

To Reproduce

  1. Write a config.json file that imports any plugins,
  2. start the API server while passing in the config.json file as the config file path and then
  3. watch it crash and burn because the runtime plugin imports are failing.

Expected behavior

Plugin imports at runtime work just as well as injection from code.

Logs/Stack traces

N/A

Screenshots

N/A

Cloud provider or hardware configuration:

Local development machine (or anywhere else)

Operating system name, version, build:

$ printf "$(uname -srm)\n$(cat /etc/os-release)\n"
Linux 5.4.0-52-generic x86_64
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Hyperledger Cactus release version or commit (git rev-parse --short HEAD):

$ git rev-parse --short HEAD
1cf5176

Hyperledger Cactus Plugins/Connectors Used

Literally any plugin will cause the mentioned crash.

Additional context

Been having a hard time convincing the webpack maintainers to accept the proposal so if you have a second, please head over there and support it with a thumbs up reaction or similar => webpack/webpack#11316

cc: @sfuji822 @jonathan-m-hamilton @takeutak

@petermetz petermetz added bug Something isn't working API_Server labels Nov 4, 2020
@petermetz petermetz added this to the v0.3.0 milestone Nov 4, 2020
petermetz added a commit to petermetz/cacti that referenced this issue Nov 7, 2020
- Upgrades webpack to the version[1] of it that
supports the webpackIgnore magic comment
for require calls not just for import calls.

- Adds a dedicated test package for the API server
which is necessary because that's how we can
verify that not just the Typescript compilation
output (./dist/lib/.../*.js) files but also
the webpack bundles are good when it comes to
runtime plugin importing.
Why? Because only when importing from another
package will the bundle be used so the local
test cases inside the cmd-api-server package
directory could not verify this particular
edge case.

[1]: This version is not yet officially released
becaue the PR for it has been stuck without review
since August 2020 so for now the workaround for
that is to specify the webpack version as the
direct commit reference on the fork that has the
required enhancements for this issue to be resolved.

Fixes hyperledger-cacti#346

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Nov 12, 2020
- Upgrades webpack to the version[1] of it that
supports the webpackIgnore magic comment
for require calls not just for import calls.

- Adds a dedicated test package for the API server
which is necessary because that's how we can
verify that not just the Typescript compilation
output (./dist/lib/.../*.js) files but also
the webpack bundles are good when it comes to
runtime plugin importing.
Why? Because only when importing from another
package will the bundle be used so the local
test cases inside the cmd-api-server package
directory could not verify this particular
edge case.

[1]: This version is not yet officially released
becaue the PR for it has been stuck without review
since August 2020 so for now the workaround for
that is to specify the webpack version as the
direct commit reference on the fork that has the
required enhancements for this issue to be resolved.

Fixes hyperledger-cacti#346

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Dec 1, 2020
- Upgrades webpack to the version[1] of it that
supports the webpackIgnore magic comment
for require calls not just for import calls.

- Adds a dedicated test package for the API server
which is necessary because that's how we can
verify that not just the Typescript compilation
output (./dist/lib/.../*.js) files but also
the webpack bundles are good when it comes to
runtime plugin importing.
Why? Because only when importing from another
package will the bundle be used so the local
test cases inside the cmd-api-server package
directory could not verify this particular
edge case.

[1]: This version is not yet officially released
becaue the PR for it has been stuck without review
since August 2020 so for now the workaround for
that is to specify the webpack version as the
direct commit reference on the fork that has the
required enhancements for this issue to be resolved.

Fixes hyperledger-cacti#346

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
@petermetz petermetz modified the milestones: v0.3.0, v0.2.0 Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API_Server bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant