connect-api-examples icon indicating copy to clipboard operation
connect-api-examples copied to clipboard

Order-Ahead Sample Application

Open michael-hilland opened this issue 5 years ago • 4 comments

Hi,

I am testing out the order ahead sample application and have already hit a problem.

On testing your credentials, I run the following command:

npm test However I get the following arror. I have tried troubleshooting but hitting a wall. Any help is greatly appreciated.

`C:\Users\Michael Hilland>npm run seed npm ERR! missing script: seed

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Michael Hilland\AppData\Roaming\npm-cache_logs\2020-11-28T17_29_04_639Z-debug.log`

michael-hilland avatar Nov 28 '20 17:11 michael-hilland

Are you getting the error when running npm test or npm run seed? Both of them exist here: https://github.com/square/connect-api-examples/blob/master/connect-examples/v2/node_orders-payments/package.json#L8, unless you've changed something in this file.

StephenJosey avatar Dec 01 '20 16:12 StephenJosey

Morning, I have resolved by using the following:

npm install -g win-node-env

However, I am now still hitting a wall as I am getting the following error when running Localhost:3000

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

I have replaced my access token on the developer portal and still getting the same error.

michael-hilland avatar Dec 06 '20 10:12 michael-hilland

I am getting the error when running npm test

michael-hilland avatar Dec 06 '20 13:12 michael-hilland

The UNAUTHORIZED error means either you're using an invalid access token or it has expired. If you're using sandbox, please make sure to copy from the sandbox credentials in your dashboard and not your production.

StephenJosey avatar Dec 07 '20 16:12 StephenJosey