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

Investigate 0.2.0 docker images issue #186

Closed
Siegrift opened this issue Jan 2, 2024 · 4 comments · Fixed by #190
Closed

Investigate 0.2.0 docker images issue #186

Siegrift opened this issue Jan 2, 2024 · 4 comments · Fixed by #190
Assignees

Comments

@Siegrift
Copy link
Collaborator

Siegrift commented Jan 2, 2024

@metobom reported an issue when trying to deploy Docker image for 0.2.0 Signed API:

Node.js v18.19.0
node:fs:596
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, open '/app/config/signed-api.json'
    at Object.openSync (node:fs:596:3)
    at readFileSync (node:fs:464:35)
    at loadConfigFromFilesystem (/app/dist/src/config.js:30:78)
    at fetchConfig (/app/dist/src/config.js:37:57)
    at fetchAndCacheConfig (/app/dist/src/config.js:20:30)
    at main (/app/dist/src/index.js:7:59)
    at Object.<anonymous> (/app/dist/src/index.js:11:6)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/app/config/signed-api.json'
}
@Siegrift Siegrift self-assigned this Jan 2, 2024
@Siegrift
Copy link
Collaborator Author

Siegrift commented Jan 2, 2024

The cause of this issue was in #179 because the signed-api is now an NPM package. To build the docker images we use pnpm --filter=@api3/signed-api --prod deploy deployed-signed-api which creates all the necessary files that are then bundled in the Docker image. We have changed what files are to be published to NPM (

). This by itself doesn't cause any problems (which is also verified by e2e tests), but previously there was a folder named config so the AWS deployment trick errors out because the config folder no longer exists.

The fix is to change the CF template to first create the config folder and only then download the configuration file to it:

"mkdir config && wget -O - <SIGNED_API_CONFIGURATION_URL> >> ./config/signed-api.json && node dist/src/index.js"

I confirmed this by deploying the signed API on AWS.

@metobom
Copy link
Member

metobom commented Jan 3, 2024

I got this error while trying to deploy Airnode feed 0.2.0. Please see IMAGE LAYERS in here https://hub.docker.com/layers/api3/airnode-feed/0.2.0/images/sha256-2f5d179d0f65acb85bf9c5ef7a20fd034ed4d14abf7d26ce40f5f5181f9cad07?context=explore

@bdrhn9
Copy link
Contributor

bdrhn9 commented Jan 4, 2024

I think I found the cause of the issue. In the following package.json script, --target is missing for the script used to build docker images on macOS.

"docker:build:amd64": "docker buildx build --platform linux/amd64 --tag api3/airnode-feed:latest ../../",

AFAIK, @Siegrift uses macOS, so that's why resulted images always creates signed-api target. I'm creating PR that fixing this.

@Siegrift
Copy link
Collaborator Author

Siegrift commented Jan 7, 2024

I see. Sorry @metobom I misunderstood your issue, because I saw that the error was saying it couldn't find the signed-api.json file. The fix from @bdrhn9 should fix the issue and I will release a patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants