angular2 Uncaught TypeError: Cannot read property 'isDefaultChangeDetectionStrategy' in Chrome - google-chrome

My app local works in local and used to work in production. However, I get this error on console in production.
main.fd49057….bundle.js:57 Uncaught TypeError: Cannot read property 'isDefaultChangeDetectionStrategy' of undefined
at Object.<anonymous> (main.fd49057….bundle.js:57)
at r (inline.js:1)
at Object.<anonymous> (main.fd49057….bundle.js:43)
at r (inline.js:1)
at Object.<anonymous> (main.fd49057….bundle.js:1721)
at r (inline.js:1)
at Object.<anonymous> (main.fd49057….bundle.js:1658)
at r (inline.js:1)
at Object.<anonymous> (main.fd49057….bundle.js:1693)
at r (inline.js:1)
This is how I deploy to production on s3
ng build -prod
aws --profile ttt s3 sync dist/ s3://angular.bhead.com --acl public-read
I then deployed on firebase and it works...
Most disturbing is that it works in FF and Safari in production. I get this error in Chrome only with deployment in either s3 or Firebase.

Check your version of angular and make sure it matches all the other related libraries. I had the same issue when I added Angular 4's core library. I doesn't hold the angular core object in the same property as the previous versions. I hope that helps.

Related

deploying lambda with cdk doesn't recognize sdk nodejs v3

I am learning aws lambda, cdk and dynamodb and as a test am trying to update a lambda function code written in aws-sdk js v2 to v3, but after deploying it it doesn't work. I copy pasted the same code in a test lambda function directly in the web console and it worked fine.
Here is the error shown in cloudwatch:
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module '#aws-sdk/client-dynamodb'\nRequire stack:\n- /var/task/hitcounter.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module '#aws-sdk/client-dynamodb'",
"Require stack:",
"- /var/task/hitcounter.js",
"- /var/runtime/UserFunction.js",
"- /var/runtime/index.js",
" at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
" at Object.<anonymous> (/var/runtime/index.js:43:30)",
" at Module._compile (internal/modules/cjs/loader.js:1072:14)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)",
" at Module.load (internal/modules/cjs/loader.js:937:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:778:12)",
" at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)",
" at internal/main/run_main_module.js:17:47"
]
}
is there a cdk related settings I have to set or change that allows me to use #aws-sdk v3? I don't want to use v2 since I am starting a project from start and rather use newer API's.
The AWS Lambda NodeJS environments come with AWS SDK v2.952.0 as of writing this. This is valid for any of the following runtimes: Node.js 10, Node.js 12, Node.js 14.
AWS has an official video on how to make a custom SDK version (including v3) available to your Lambda using Lambda layers.
Alternatively, since you use AWS CDK and the NodejsFunction construct, you can bundle it inside your Lambda artifact directly, by declaring it in the node_modules prop, as described here. Remember that you need to declare aws-sdk v3 as a dependency in your package.json file if you go this way.
Lambda environment doesn’t have SDK v3. You must bundle it. Use NodejsLambda construct which will bundle the code for you using esbuild.

offline: Failure: package.json does not exist at /home/denzilgupta/serverless-testing/.webpack/service/services/trader/package.json

I am getting the following error while running serverless offline start
Can someone help me with this?
offline: POST /dev/trader/create (λ: CreateTrader)
offline: Failure: package.json does not exist at /home/denzilgupta/serverless-testing/.webpack/service/services/trader/package.json
Error: package.json does not exist at /home/denzilgupta/serverless-testing/.webpack/service/services/trader/package.json
at Object.../../node-pre-gyp/lib/pre-binding.js.exports.find (/home/denzilgupta/serverless-testing/.webpack/service/services/trader/webpack:/home/denzilgupta/serverless-testing/node_modules/node-pre-gyp/lib/pre-binding.js:18:1)
at Object.../../bcrypt/bcrypt.js (/home/denzilgupta/serverless-testing/.webpack/service/services/trader/webpack:/home/denzilgupta/serverless-testing/node_modules/bcrypt/bcrypt.js:5:1)
at webpack_require (/home/denzilgupta/serverless-testing/.webpack/service/services/trader/webpack:/webpack/bootstrap:19:1)
at Module.../../../services/trader/handler.js (/home/denzilgupta/serverless-testing/.webpack/service/services/trader/handler.js:164:64)
at webpack_require (/home/denzilgupta/serverless-testing/.webpack/service/services/trader/webpack:/webpack/bootstrap:19:1)
at /home/denzilgupta/serverless-testing/.webpack/service/services/trader/webpack:/webpack/bootstrap:83:1
at Object. (/home/denzilgupta/serverless-testing/.webpack/service/services/trader/handler.js:87:10)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at /home/denzilgupta/serverless-testing/node_modules/serverless-offline/dist/lambda/handler-runner/in-process-runner/InProcessRunner.js:67:133
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at InProcessRunner.run (/home/denzilgupta/serverless-testing/node_modules/serverless-offline/dist/lambda/handler-runner/in-process-runner/InProcessRunner.js:67:9)
Looks like bcrypt work as a native module for nodeJS, probably it contains some DLL and/or binaries. To load this kind of module nodeJS needs the full path to the lib, it does not work well with module bundlers like webpack. It would work as an external plugin but it seems that it does not attend your use case as you are using serverless framework and need to bundle everything together.
I suggest changing to bcryptjs, it is 30% slower because of the implementation in JS instead of using C++ but it works with webpack.

Cheerio errors at runtime when built using rollup, dependency resolution seems to be the issue

Hi I've been trying to use cheerio in my node library and found this error, i've narrowed it down to rollup not correctly getting the dependency other then that I'm at a loss
enviroment
OS macOS Mojave Version 10.14.3
Node v11.4.0
Rollup 1.6.0
Cheerio 1.0.0-rc.2
repo with error https://github.com/lukecollier/cheerio-rollup-problems
i get a stack trace with
util.js:307
throw new ERR_INVALID_ARG_TYPE('superCtor', 'Function', superCtor);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "superCtor" argument must be of type Function. Received type undefined
at inherits (util.js:307:11)
at Object.<anonymous> (/Users/collierl/Project/Learn/cheerio-rollup-problem/index.js:10575:1)
at Module._compile (internal/modules/cjs/loader.js:723:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:776:12)
at executeUserCode (internal/bootstrap/node.js:342:17)
at startExecution (internal/bootstrap/node.js:276:5)
when I look into the output javascript it seems that it's a rollup error not adding the right dependencies but I want to make sure I'm not missing something before opening a issue

Error migrating truffle rinkeby [Cannot read property 'bind' of undefined]

I'm trying to deploy/migrate contract to rinkeby network, while using command:
truffle deploy --reset --network=rinkeby
It loads the keys and afterwards throws error:
C:\Users\marti\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-provider\wrapper.js:26
var originalSendAsync = provider.sendAsync.bind(provider);
TypeError: Cannot read property 'bind' of undefined
I'm able to run truffle develop without any issues
I'm also using:
truffle-hdwallet-provider
zappelin-solidity
Okay so the issue was comming from the truffle-hdwallet-provider version.
changing the ver from : 1.0.0-web3one.2
to : 0.0.6
solved the issue

Parsing error in Ionic Config file. Please make sure it is valid JSON

All of a sudden, I'm getting this while trying to run ionic. What's wrong?
My Laptop Suddenly Crashes and when I restarted my System and Open Ionic in Code Editor it shows the Following Error:
Unable to parse Ionic Config file. Please make sure it is valid JSON (.ionic/ionic.config)
Caught exception:
SyntaxError: Unexpected token
at Object.parse (native)
at Object.module.exports.load (C:\Users\BBytes\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\lib\config.js:14:26)
at Object.<anonymous> (C:\Users\BBytes\AppData\Roaming\npm\node_modules\ionic\lib\utils\stats.js:31:31)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\BBytes\AppData\Roaming\npm\node_modules\ionic\lib\cli.js:3:18)
Mind letting us know? https://github.com/driftyco/ionic-cli/issues
After Some trial and Error:
I think I have found the source of my problem!
My C:/Users/{username}/.ionic/ionic.config file was corrupted when my pc crashed /or due to some other error.
Weird that that file NEVER gets cleared when uninstalling ionic.
Just Delete the file and when you run ionic serve it will create the file by default in the folder.