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

Error running server from example #25

Closed
tfalencar opened this issue Aug 5, 2022 · 3 comments
Closed

Error running server from example #25

tfalencar opened this issue Aug 5, 2022 · 3 comments

Comments

@tfalencar
Copy link

tfalencar commented Aug 5, 2022

I tried to give the example a spin, but failed when starting the server.

Node version: v16.15.0
OS: MacOS Monterey 12.5
Processor: Apple M1

cd ../server
yarn start

yarn run v1.22.17
$ yarn build && node dist/index.js
$ tsdx build
@rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
@rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
✓ Creating entry file 2.2 secs
⠹ Building modules
Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
(typescript) Error: /[redacted]/ccip-read/packages/examples/trusted-gateway-token/server/src/app.ts(1,24): semantic error TS2307: Cannot find module '@chainlink/ccip-read-server' or its corresponding type declarations.
Error: /[redacted]/ccip-read/packages/examples/trusted-gateway-token/server/src/app.ts(1,24): semantic error TS2307: Cannot find module '@chainlink/ccip-read-server' or its corresponding type declarations.
    at error (/[redacted]ccip-read/node_modules/rollup/dist/shared/node-entry.js:5400:30)
    at throwPluginError (/[redacted]/ccip-read/node_modules/rollup/dist/shared/node-entry.js:11878:12)
    at Object.error (/[redacted]/ccip-read/node_modules/rollup/dist/shared/node-entry.js:12912:24)
    at Object.error (/[redacted]/ccip-read/node_modules/rollup/dist/shared/node-entry.js:12081:38)
    at RollupContext.error (/[redacted]/ccip-read/node_modules/tsdx/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:17237:30)
    at /[redacted]/ccip-read/node_modules/tsdx/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:25033:23
    at arrayEach (/[redacted]/ccip-read/node_modules/tsdx/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:545:11)
    at Function.forEach (/[redacted]/ccip-read/node_modules/tsdx/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:9397:14)
    at printDiagnostics (/[redacted]/ccip-read/node_modules/tsdx/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:25006:12)
    at Object.transform (/[redacted]/ccip-read/node_modules/tsdx/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:29277:17)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Note: Running npx browserslist@latest --update-db doesn't solve it.

@mdtanrikulu
Copy link
Collaborator

Hi! Could you retry installing dependencies and running again? What I see from logs is, @chainlink/ccip-read-server is not installed.

Running yarn in packages/examples/trusted-gateway-token/server should help for the necessary dependencies.

@tfalencar
Copy link
Author

tfalencar commented Aug 8, 2022

I've tried that, but got the same error. I supposed running yarn start also invokes yarn install so it's effectively the same. It appears that setting the version like this solves the problem:

-    "@chainlink/ethers-ccip-read-provider": "0.2.2",
+    "@chainlink/ethers-ccip-read-provider": "^0.2.2",

(or removing and installing the package again also solves it)

After this was fixed, I'm getting now the following error when running 'yarn start' from the client folder:

/external/ccip-read/packages/examples/trusted-gateway-token/client/node_modules/@chainlink/ethers-ccip-read-provider/node_modules/@ethersproject/logger/lib/index.js:199
        var error = new Error(message);
                    ^

Error: bad response (status=404, headers={"x-powered-by":"Express","access-control-allow-origin":"*","content-security-policy":"default-src 'none'","x-content-type-options":"nosniff","content-type":"text/html; charset=utf-8","content-length":"140","date":"Mon, 08 Aug 2022 15:11:36 GMT","connection":"close"}, body="<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot POST /</pre>\n</body>\n</html>\n", requestBody="{\"sender\":\"0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9\",\"data\":\"0xce93871500000000000000000000000070997970c51812dc3a010c7d01b50e0d17dc79c8\"}", requestMethod="POST", url="http://localhost:8080/", code=SERVER_ERROR, version=web/5.5.1)
    at Logger.makeError (/external/ccip-read/packages/examples/trusted-gateway-token/client/node_modules/@chainlink/ethers-ccip-read-provider/node_modules/@ethersproject/logger/lib/index.js:199:21)
    at Logger.throwError (/external/ccip-read/packages/examples/trusted-gateway-token/client/node_modules/@chainlink/ethers-ccip-read-provider/node_modules/@ethersproject/logger/lib/index.js:208:20)
    at /external/ccip-read/packages/examples/trusted-gateway-token/client/node_modules/@chainlink/ethers-ccip-read-provider/node_modules/@ethersproject/web/lib/index.js:263:36
    at step (/external/ccip-read/packages/examples/trusted-gateway-token/client/node_modules/@chainlink/ethers-ccip-read-provider/node_modules/@ethersproject/web/lib/index.js:33:23)
    at Object.next (/external/ccip-read/packages/examples/trusted-gateway-token/client/node_modules/@chainlink/ethers-ccip-read-provider/node_modules/@ethersproject/web/lib/index.js:14:53)
    at fulfilled (/external/ccip-read/packages/examples/trusted-gateway-token/client/node_modules/@chainlink/ethers-ccip-read-provider/node_modules/@ethersproject/web/lib/index.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  reason: 'bad response',
  code: 'SERVER_ERROR',
  status: 404,
  headers: {
    'x-powered-by': 'Express',
    'access-control-allow-origin': '*',
    'content-security-policy': "default-src 'none'",
    'x-content-type-options': 'nosniff',
    'content-type': 'text/html; charset=utf-8',
    'content-length': '140',
    date: 'Mon, 08 Aug 2022 15:11:36 GMT',
    connection: 'close'
  },
  body: '<!DOCTYPE html>\n' +
    '<html lang="en">\n' +
    '<head>\n' +
    '<meta charset="utf-8">\n' +
    '<title>Error</title>\n' +
    '</head>\n' +
    '<body>\n' +
    '<pre>Cannot POST /</pre>\n' +
    '</body>\n' +
    '</html>\n',
  requestBody: '{"sender":"0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9","data":"0xce93871500000000000000000000000070997970c51812dc3a010c7d01b50e0d17dc79c8"}',
  requestMethod: 'POST',
  url: 'http://localhost:8080/'
}
error Command failed with exit code 1.

@tfalencar
Copy link
Author

Ok, I had to delete all node_modules folders (including the ones in the sub-projects), then reinstall everything again , then it started working). Thanks for your help.

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

No branches or pull requests

2 participants