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

node_orders-payments example is outdated #196

Open
JonathanLindsey opened this issue Jun 19, 2020 · 4 comments
Open

node_orders-payments example is outdated #196

JonathanLindsey opened this issue Jun 19, 2020 · 4 comments
Labels
Node.js Pull requests and issues related to the Node.js samples

Comments

@JonathanLindsey
Copy link

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>
@michael-hilland
Copy link

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 Authorization http 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]."
}
]

@JonathanLindsey
Copy link
Author

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.

@emmac3
Copy link
Contributor

emmac3 commented Apr 8, 2021

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?

@emmac3
Copy link
Contributor

emmac3 commented Apr 8, 2021

Response status code was not ok: 401.
[
{
"category": "AUTHENTICATION_ERROR",
"code": "UNAUTHORIZED",
"detail": "The Authorization http 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.

@mglombicki-square mglombicki-square added the Node.js Pull requests and issues related to the Node.js samples label Jul 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Node.js Pull requests and issues related to the Node.js samples
Projects
None yet
Development

No branches or pull requests

4 participants