node_orders-payments example is outdated
I am new to npm so please forgive if this is something I am doing wrong.
I downloaded the connect-api-examples/connect-examples/v2/node_orders-payments folder, put my sandbox credentials in the config.json file, and ran npm install. I get a lot of deprecated warnings including a mention of "insecure binaries". Could the example be updated so that I do not get these warnings please? This is the output of my npm install command:
D:\Users\Jonathan\Desktop\Programming\node_orders-payments>npm install
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
> [email protected] postinstall D:\Users\Jonathan\Desktop\Programming\node_orders-payments\node_modules\nodemon
> node bin/postinstall || exit 0
Love nodemon? You can now support the project via the open collective:
> https://opencollective.com/nodemon/donate
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
added 478 packages from 283 contributors and audited 479 packages in 19.164s
11 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
D:\Users\Jonathan\Desktop\Programming\node_orders-payments>
Morning,
Did you get this resolved?
I am currently having issues with npm test on this sample app example and getting the following error:
Response status code was not ok: 401. [ { "category": "AUTHENTICATION_ERROR", "code": "UNAUTHORIZED", "detail": "The
Authorizationhttp header of your request was malformed. The header value is expected to be of the format "Bearer TOKEN" (without quotation marks), where TOKEN is to be replaced with your access token (e.g. "Bearer ABC123def456GHI789jkl0"). For more information, see https://developer.squareup.com/docs/build-basics/using-rest-api#set-the-headers. If you are seeing this error message while using one of our officially supported SDKs, please report this to [email protected]." } ]
I haven't tested in a while but I did not get it resolved.
I might be missing something but your error looks like it is something different. Different command, entirely different output.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
May I know what version of Node.js you are using?
Response status code was not ok: 401. [ { "category": "AUTHENTICATION_ERROR", "code": "UNAUTHORIZED", "detail": "The
Authorizationhttp header of your request was malformed. The header value is expected to be of the format "Bearer TOKEN" (without quotation marks), where TOKEN is to be replaced with your access token (e.g. "Bearer ABC123def456GHI789jkl0"). For more information, see https://developer.squareup.com/docs/build-basics/using-rest-api#set-the-headers. If you are seeing this error message while using one of our officially supported SDKs, please report this to [email protected]." } ]
This error sounds like your .env file isn't filled properly with the correct ACCESS_TOKEN. i.e. if you are running node test which uses the sandbox, please make sure your .env file contains SQUARE_SANDBOX_ACCESS_TOKEN and SQUARE_SANDBOX_APPLICATION_ID. Note that these values should be retrieved from your application's dashboard in sandbox mode. i.e. Sandbox Application ID should start with sandbox-.
For the node start command, make sure to use the production mode values. Please see .env.example for an example .env file.