microsoft/TailwindTraders-Backend

CashLoopBackoff after Application Insights additions

neilpeterson opened this issue · 4 comments

I am trying to start the backend with updated images containing the application insights additions. Several are failing to start.

Steps taken:

  • I've created a values file and validated that the application insights instrumentation key has been populated.
  • I've started the cart, coupon, and products APIs using the included charts. The cart starts fine, the other two fail with the below logs.
  • I've looked at the config map for each and do see the application insights instrumentation key. I've copied the config map values below for the two failed services.

coupon-api

logs:

> shoppingcartserver@0.0.0 start /src
> node ./bin/www

Local environment detected
WARNING: Disabled checking of self-signed certs. Do not have this code in production.
Go to http://localhost:3001 to try the sample.
/src/node_modules/applicationinsights/out/AutoCollection/Exceptions.js:34
                        throw THIS_IS_APPLICATION_INSIGHTS_RETHROWING_YOUR_EXCEPTION; // Error originated somewhere else in your app
                        ^

SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (/src/app.js:36:10)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at Object.<anonymous> (/src/bin/www:7:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! shoppingcartserver@0.0.0 start: `node ./bin/www`
npm ERR! Exit status 7
npm ERR! 
npm ERR! Failed at the shoppingcartserver@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-08-27T04_42_58_980Z-debug.log

config map secrets removed.

data:
  APPLICATIONINSIGHTSIK: ***
  CONNECTIONSTRING: ***
  COUPON_COLLECTION: CouponCollection
  ISSUER: TTFakeLogin
  SECURITYKEY: ***
  URL_BASE: https://ttstoragevk7einhhudcse.blob.core.windows.net/coupon-list

products

logs

> shoppingcartserver@0.0.0 start /src
> node ./bin/www

Local environment detected
WARNING: Disabled checking of self-signed certs. Do not have this code in production.
Go to http://localhost:3001 to try the sample.
undefined:1
undefined
^

SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (/src/app.js:36:10)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at Object.<anonymous> (/src/bin/www:7:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! shoppingcartserver@0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the shoppingcartserver@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-08-27T04_43_28_030Z-debug.log

config map secrets removed

  ApplicationInsights__InstrumentationKey: ***
  ConnectionString: ***
  ISSUER: TTFakeLogin
  ProductDetailImagesUrl: https://ttstoragevk7einhhudcse.blob.core.windows.net/product-detail
  ProductImagesUrl: https://ttstoragevk7einhhudcse.blob.core.windows.net/product-list
  ProductVisitsUrl: ""
  SECURITYKEY: ***

Any thoughts on what might be missing that would prevent these services from starting?

Hello @neilpeterson,
did you run Build-Push.ps1 script?,
if you have more information do not hesitate to contact me, you can write it here,
thanks,
regards,

I did not, the image we are using are not stored in an Azure Container Registry, which seems like a requirement for that script. I did take the helm commands directly from the build-push script and have run those manually.

helm install --name my-tt-cart -f $tailwindChartValues --set ingress.hosts={$INGRESS} --set image.repository=$containerRegistry/cart.api --set image.tag=$containerVersion $tailwindCharts/cart-api

helm install --name my-tt-product -f $tailwindChartValues --set az.productvisitsurl=http://your-product-visits-af-here --set ingress.hosts={$INGRESS} --set image.repository=$containerRegistry/product.api --set image.tag=$containerVersion $tailwindCharts/products-api

helm install --name my-tt-coupon -f $tailwindChartValues --set ingress.hosts={$INGRESS} --set image.repository=$containerRegistry/coupon.api --set image.tag=$containerVersion $tailwindCharts/coupons-api

One note in case it did not stand out, the cart works fine, coupons and products do not. I did not try any of the others.

Hello @neilpeterson ,
you are probably using the commands in .sh scripts, we are not currently supporting bash scripts,
Could you check Deploy-Images-Aks.ps1 commands to deploy the images in AKS?,
thanks,
regards,

@cdemiguel thanks. I was able to get everything running after looking at the PowerShell script.