429: Too Many Requests
Monthly Archives: July 2019
[ javascript testing ] cypress
ref : https://www.cypress.io/
[ dom-testing-library ] test any JS framework
including plain JS, ReactJS and https://svelte.technology/
testing any JS framework : https://github.com/testing-library/dom-testing-library
React testing library : https://github.com/testing-library/react-testing-library
- JasperReports
ref : https://testingjavascript.com/, https://www.youtube.com/watch?v=hZFgyoImTx0&list=PLV5CVI1eNcJgCrPH_e6d57KRUTiDZgs0u
[ javascript testing ] abstractions for mocking
The Jest testing framework : https://jestjs.io/
Mock function : https://jestjs.io/docs/en/mock-functions.html
Mock module : https://jestjs.io/docs/en/manual-mocks.html
Testing Pyramids & Ice-Cream Cones
[ netlify lambda functions ] axios error
Problem
7:13:06 PM: 2019-07-23T12:13:06.039Z 27c91540-f8f7-45a4-a9b7-fe24cb76718c (node:1) UnhandledPromiseRejectionWarning: Error: read ECONNRESET at _errnoException (util.js:1022:11) at TCP.onread (net.js:628:25) 2019-07-23T12:13:06.039Z 27c91540-f8f7-45a4-a9b7-fe24cb76718c (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) 2019-07-23T12:13:06.039Z 27c91540-f8f7-45a4-a9b7-fe24cb76718c (node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Solution
Use `callback` instead of `return`
Use
callback(null, { statusCode: 200, body })
Instead of
return { statusCode: 200, body }
[ github ] releases, tags
Settings > Developer settings > Personal Access Token
[ github ] extract github pr hook using PHP
In github, choose
Content type : application/json
Example code to decode
$data_array = json_decode(file_get_contents( 'php://input' ), true); $data = var_export($data_array, true);
Example array callback
array ( 'action' => 'closed', 'number' => 28, 'pull_request' => array ( 'url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/pulls/28', 'id' => 297456404, 'node_id' => 'MDExOlB1bGxSZXF1ZXN0Mjk3NDU2NDA0', 'html_url' => 'https://github.com/phong-wildsky/pong-test-repo/pull/28', 'diff_url' => 'https://github.com/phong-wildsky/pong-test-repo/pull/28.diff', 'patch_url' => 'https://github.com/phong-wildsky/pong-test-repo/pull/28.patch', 'issue_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/issues/28', 'number' => 28, 'state' => 'closed', 'locked' => false, 'title' => 'Update README.md', 'user' => array ( 'login' => 'phong-wildsky', 'id' => 25359460, 'node_id' => 'MDQ6VXNlcjI1MzU5NDYw', 'avatar_url' => 'https://avatars0.githubusercontent.com/u/25359460?v=4', 'gravatar_id' => '', 'url' => 'https://api.github.com/users/phong-wildsky', 'html_url' => 'https://github.com/phong-wildsky', 'followers_url' => 'https://api.github.com/users/phong-wildsky/followers', 'following_url' => 'https://api.github.com/users/phong-wildsky/following{/other_user}', 'gists_url' => 'https://api.github.com/users/phong-wildsky/gists{/gist_id}', 'starred_url' => 'https://api.github.com/users/phong-wildsky/starred{/owner}{/repo}', 'subscriptions_url' => 'https://api.github.com/users/phong-wildsky/subscriptions', 'organizations_url' => 'https://api.github.com/users/phong-wildsky/orgs', 'repos_url' => 'https://api.github.com/users/phong-wildsky/repos', 'events_url' => 'https://api.github.com/users/phong-wildsky/events{/privacy}', 'received_events_url' => 'https://api.github.com/users/phong-wildsky/received_events', 'type' => 'User', 'site_admin' => false, ), 'body' => '29', 'created_at' => '2019-07-15T03:15:50Z', 'updated_at' => '2019-07-15T03:21:37Z', 'closed_at' => '2019-07-15T03:21:37Z', 'merged_at' => '2019-07-15T03:21:37Z', 'merge_commit_sha' => 'a5ca5dda6949ad0f23450de64d1e9c5246985be0', 'assignee' => NULL, 'assignees' => array ( ), 'requested_reviewers' => array ( ), 'requested_teams' => array ( ), 'labels' => array ( ), 'milestone' => NULL, 'commits_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/pulls/28/commits', 'review_comments_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/pulls/28/comments', 'review_comment_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/pulls/comments{/number}', 'comments_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/issues/28/comments', 'statuses_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/statuses/4176ebb4e8d2c9be5ca39fe719d71ad9c721f0cf', 'head' => array ( 'label' => 'phong-wildsky:test-branch-29', 'ref' => 'test-branch-29', 'sha' => '4176ebb4e8d2c9be5ca39fe719d71ad9c721f0cf', 'user' => array ( 'login' => 'phong-wildsky', 'id' => 25359460, 'node_id' => 'MDQ6VXNlcjI1MzU5NDYw', 'avatar_url' => 'https://avatars0.githubusercontent.com/u/25359460?v=4', 'gravatar_id' => '', 'url' => 'https://api.github.com/users/phong-wildsky', 'html_url' => 'https://github.com/phong-wildsky', 'followers_url' => 'https://api.github.com/users/phong-wildsky/followers', 'following_url' => 'https://api.github.com/users/phong-wildsky/following{/other_user}', 'gists_url' => 'https://api.github.com/users/phong-wildsky/gists{/gist_id}', 'starred_url' => 'https://api.github.com/users/phong-wildsky/starred{/owner}{/repo}', 'subscriptions_url' => 'https://api.github.com/users/phong-wildsky/subscriptions', 'organizations_url' => 'https://api.github.com/users/phong-wildsky/orgs', 'repos_url' => 'https://api.github.com/users/phong-wildsky/repos', 'events_url' => 'https://api.github.com/users/phong-wildsky/events{/privacy}', 'received_events_url' => 'https://api.github.com/users/phong-wildsky/received_events', 'type' => 'User', 'site_admin' => false, ), 'repo' => array ( 'id' => 154774092, 'node_id' => 'MDEwOlJlcG9zaXRvcnkxNTQ3NzQwOTI=', 'name' => 'pong-test-repo', 'full_name' => 'phong-wildsky/pong-test-repo', 'private' => false, 'owner' => array ( 'login' => 'phong-wildsky', 'id' => 25359460, 'node_id' => 'MDQ6VXNlcjI1MzU5NDYw', 'avatar_url' => 'https://avatars0.githubusercontent.com/u/25359460?v=4', 'gravatar_id' => '', 'url' => 'https://api.github.com/users/phong-wildsky', 'html_url' => 'https://github.com/phong-wildsky', 'followers_url' => 'https://api.github.com/users/phong-wildsky/followers', 'following_url' => 'https://api.github.com/users/phong-wildsky/following{/other_user}', 'gists_url' => 'https://api.github.com/users/phong-wildsky/gists{/gist_id}', 'starred_url' => 'https://api.github.com/users/phong-wildsky/starred{/owner}{/repo}', 'subscriptions_url' => 'https://api.github.com/users/phong-wildsky/subscriptions', 'organizations_url' => 'https://api.github.com/users/phong-wildsky/orgs', 'repos_url' => 'https://api.github.com/users/phong-wildsky/repos', 'events_url' => 'https://api.github.com/users/phong-wildsky/events{/privacy}', 'received_events_url' => 'https://api.github.com/users/phong-wildsky/received_events', 'type' => 'User', 'site_admin' => false, ), 'html_url' => 'https://github.com/phong-wildsky/pong-test-repo', 'description' => NULL, 'fork' => false, 'url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo', 'forks_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/forks', 'keys_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/keys{/key_id}', 'collaborators_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/collaborators{/collaborator}', 'teams_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/teams', 'hooks_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/hooks', 'issue_events_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/issues/events{/number}', 'events_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/events', 'assignees_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/assignees{/user}', 'branches_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/branches{/branch}', 'tags_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/tags', 'blobs_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/git/blobs{/sha}', 'git_tags_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/git/tags{/sha}', 'git_refs_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/git/refs{/sha}', 'trees_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/git/trees{/sha}', 'statuses_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/statuses/{sha}', 'languages_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/languages', 'stargazers_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/stargazers', 'contributors_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/contributors', 'subscribers_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/subscribers', 'subscription_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/subscription', 'commits_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/commits{/sha}', 'git_commits_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/git/commits{/sha}', 'comments_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/comments{/number}', 'issue_comment_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/issues/comments{/number}', 'contents_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/contents/{+path}', 'compare_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/compare/{base}...{head}', 'merges_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/merges', 'archive_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/{archive_format}{/ref}', 'downloads_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/downloads', 'issues_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/issues{/number}', 'pulls_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/pulls{/number}', 'milestones_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/milestones{/number}', 'notifications_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/notifications{?since,all,participating}', 'labels_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/labels{/name}', 'releases_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/releases{/id}', 'deployments_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/deployments', 'created_at' => '2018-10-26T03:48:35Z', 'updated_at' => '2019-07-15T03:12:41Z', 'pushed_at' => '2019-07-15T03:21:37Z', 'git_url' => 'git://github.com/phong-wildsky/pong-test-repo.git', 'ssh_url' => 'git@github.com:phong-wildsky/pong-test-repo.git', 'clone_url' => 'https://github.com/phong-wildsky/pong-test-repo.git', 'svn_url' => 'https://github.com/phong-wildsky/pong-test-repo', 'homepage' => NULL, 'size' => 29, 'stargazers_count' => 0, 'watchers_count' => 0, 'language' => NULL, 'has_issues' => true, 'has_projects' => true, 'has_downloads' => true, 'has_wiki' => true, 'has_pages' => false, 'forks_count' => 0, 'mirror_url' => NULL, 'archived' => false, 'disabled' => false, 'open_issues_count' => 2, 'license' => NULL, 'forks' => 0, 'open_issues' => 2, 'watchers' => 0, 'default_branch' => 'master', ), ), 'base' => array ( 'label' => 'phong-wildsky:master', 'ref' => 'master', 'sha' => 'df9d6ca2a55d5a556af07069fb78cdc8dfee86e6', 'user' => array ( 'login' => 'phong-wildsky', 'id' => 25359460, 'node_id' => 'MDQ6VXNlcjI1MzU5NDYw', 'avatar_url' => 'https://avatars0.githubusercontent.com/u/25359460?v=4', 'gravatar_id' => '', 'url' => 'https://api.github.com/users/phong-wildsky', 'html_url' => 'https://github.com/phong-wildsky', 'followers_url' => 'https://api.github.com/users/phong-wildsky/followers', 'following_url' => 'https://api.github.com/users/phong-wildsky/following{/other_user}', 'gists_url' => 'https://api.github.com/users/phong-wildsky/gists{/gist_id}', 'starred_url' => 'https://api.github.com/users/phong-wildsky/starred{/owner}{/repo}', 'subscriptions_url' => 'https://api.github.com/users/phong-wildsky/subscriptions', 'organizations_url' => 'https://api.github.com/users/phong-wildsky/orgs', 'repos_url' => 'https://api.github.com/users/phong-wildsky/repos', 'events_url' => 'https://api.github.com/users/phong-wildsky/events{/privacy}', 'received_events_url' => 'https://api.github.com/users/phong-wildsky/received_events', 'type' => 'User', 'site_admin' => false, ), 'repo' => array ( 'id' => 154774092, 'node_id' => 'MDEwOlJlcG9zaXRvcnkxNTQ3NzQwOTI=', 'name' => 'pong-test-repo', 'full_name' => 'phong-wildsky/pong-test-repo', 'private' => false, 'owner' => array ( 'login' => 'phong-wildsky', 'id' => 25359460, 'node_id' => 'MDQ6VXNlcjI1MzU5NDYw', 'avatar_url' => 'https://avatars0.githubusercontent.com/u/25359460?v=4', 'gravatar_id' => '', 'url' => 'https://api.github.com/users/phong-wildsky', 'html_url' => 'https://github.com/phong-wildsky', 'followers_url' => 'https://api.github.com/users/phong-wildsky/followers', 'following_url' => 'https://api.github.com/users/phong-wildsky/following{/other_user}', 'gists_url' => 'https://api.github.com/users/phong-wildsky/gists{/gist_id}', 'starred_url' => 'https://api.github.com/users/phong-wildsky/starred{/owner}{/repo}', 'subscriptions_url' => 'https://api.github.com/users/phong-wildsky/subscriptions', 'organizations_url' => 'https://api.github.com/users/phong-wildsky/orgs', 'repos_url' => 'https://api.github.com/users/phong-wildsky/repos', 'events_url' => 'https://api.github.com/users/phong-wildsky/events{/privacy}', 'received_events_url' => 'https://api.github.com/users/phong-wildsky/received_events', 'type' => 'User', 'site_admin' => false, ), 'html_url' => 'https://github.com/phong-wildsky/pong-test-repo', 'description' => NULL, 'fork' => false, 'url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo', 'forks_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/forks', 'keys_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/keys{/key_id}', 'collaborators_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/collaborators{/collaborator}', 'teams_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/teams', 'hooks_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/hooks', 'issue_events_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/issues/events{/number}', 'events_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/events', 'assignees_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/assignees{/user}', 'branches_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/branches{/branch}', 'tags_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/tags', 'blobs_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/git/blobs{/sha}', 'git_tags_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/git/tags{/sha}', 'git_refs_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/git/refs{/sha}', 'trees_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/git/trees{/sha}', 'statuses_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/statuses/{sha}', 'languages_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/languages', 'stargazers_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/stargazers', 'contributors_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/contributors', 'subscribers_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/subscribers', 'subscription_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/subscription', 'commits_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/commits{/sha}', 'git_commits_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/git/commits{/sha}', 'comments_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/comments{/number}', 'issue_comment_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/issues/comments{/number}', 'contents_url' => 'https://api.github.com/repos/phong-wildsky/pong-test-repo/contents/{+path}', 'compare_url'...(length 28436)
ref : https://developer.github.com/v3/activity/events/types/#pullrequestevent
[ gae ] Request host is not whitelist enabled for this server. Please use the –host command-line flag to whitelist a specific host (recommended) or use –enable_host_checking to disable host checking. See the command-line flags help text for more information.
Problem
Request host is not whitelist enabled for this server. Please use the --host command-line flag to whitelist a specific host (recommended) or use --enable_host_checking to disable host checking. See the command-line flags help text for more information.
Solution
dev_appserver.py app.yaml --enable_host_checking=false
[ netlify ] Environment Variables
URL : primary URL at netlify or custom domain i.e. `https://what-ever.netlify.com` or `https://www.what-ever.com`
DEPLOY_PRIME_URL : `https://eature-pong-test-url–mom-com.netlify.com`
ref : https://www.netlify.com/docs/continuous-deployment/#environment-variables