fbsamples / original-coast-clothing

Sample Messenger App - Original Coast Clothing
https://fb.me/get-sample-oc
Other
201 stars 229 forks source link

ERROR - Need a proper API_URL in the .env file #90

Closed krehy closed 3 years ago

krehy commented 3 years ago

ngrok used

After I run the application, it working until i visit "_/profile?mode=all&verifytoken=**". After that, application shut down and show "_ERROR - Need a proper APIURL in the .env file"

I Created proper API_URL int .env file but its still the same.

.env file

# Environment Config

# Store your secrets and config variables here.
# Only invited collaborators will be able to see your .env values.

# Page and Application information
PAGE_ID=<hidden>
APP_ID=<hidden>
PAGE_ACCESS_TOKEN=EAAD4NteDd3IBAKIUxzqG066JkYg6P6sHd9qJJYMqpJanJ9NYqseZBiTmgQj4EZBCIp8wiIJZBSRvBxv7mvCJ6K5yNsLf6ktFDQSJBOe0bq1UoMvumqeV3QR8sJOSHWgTfetwt54UoViLBhwFmksk1ZBVISf1HTUoNaHYmgaq4SDq3vwxY9GU

# Your App secret can be found in App Dashboard -> Settings -> Basic
APP_SECRET=<hidden>

# A random string that is used for the webhook verification request
VERIFY_TOKEN=<hidden>

# URL where you host this code
# You can use a tunneling service or Heroku ex: https://mystic-wind-83.herokuapp.com
# It must be https, and without trailing slash.
APP_URL=a8e9-2a00-1028-8d19-dd6a-71cc-3dfe-6a67-e663.ngrok.io
API_URL=https://a8e9-2a00-1028-8d19-dd6a-71cc-3dfe-6a67-e663.ngrok.io

# URL of your website where the "shop now" is located
# Can be the same as your app domain URL ex: https://www.originalcoastclothing.com/
SHOP_URL=http://a8e9-2a00-1028-8d19-dd6a-71cc-3dfe-6a67-e663.ngrok.io

# Preferred port
PORT=3000

# Note: .env is a shell file so there can't be spaces around =

Error message from node.js:

Error [ERR_STREAM_WRITE_AFTER_END]: write after end at writeAfterEnd (_http_outgoing.js:694:15) at write_ (_http_outgoing.js:706:5) at ServerResponse.write (_http_outgoing.js:687:15) at C:\Users\samue\OneDrive\Plocha\GIT\original-coast-clothing\app.js:158:13 at Layer.handle [as handle_request] (C:\Users\samue\OneDrive\Plocha\GIT\original-coast-clothing\node_modules\express\lib\router\layer.js:95:5) at next (C:\Users\samue\OneDrive\Plocha\GIT\original-coast-clothing\node_modules\express\lib\router\route.js:137:13) at Route.dispatch (C:\Users\samue\OneDrive\Plocha\GIT\original-coast-clothing\node_modules\express\lib\router\route.js:112:3) at Layer.handle [as handle_request] (C:\Users\samue\OneDrive\Plocha\GIT\original-coast-clothing\node_modules\express\lib\router\layer.js:95:5) at C:\Users\samue\OneDrive\Plocha\GIT\original-coast-clothing\node_modules\express\lib\router\index.js:281:22 at Function.process_params (C:\Users\samue\OneDrive\Plocha\GIT\original-coast-clothing\node_modules\express\lib\router\index.js:335:12) Emitted 'error' event on ServerResponse instance at: at writeAfterEndNT (_http_outgoing.js:753:7) at processTicksAndRejections (internal/process/task_queues.js:83:21) { code: 'ERR_STREAM_WRITE_AFTER_END' }

krehy commented 3 years ago

Solved

There must be "https://" before APP_URL and SHOP_URL