Cannot create an app that listens the webhook "pull_request_review_thread" - github-app

I am trying to create a simple app that will output the payload after the webhook "pull_request_review_thread" is triggered with any action. Here is the link to the related webhook: Pull_request_review_thread Github Docs
However, this code:
app.on("pull_request_review_thread", async(context) =>{ app.log.info(context.payload); })
gives the error:
Argument of type '"pull_request_review_thread"' is not assignable to parameter of type 'keyof EventTypesPayload | (keyof EventTypesPayload)[]'
Am I missing something?

The problem was not having the latest version of #octokit/webhooks-types. It can be checked with the command "npm ls #octokit/webhooks-types" , current latest version is 5.8.0

Related

Strapi: Middleware "strapi::body": Cannot destructure property 'config' of 'strapi.plugin(...)' as it is undefined

I am trying to install a fresh Strapi app on my mac, by running the
npx create-strapi-app#latest my-project --quickstart
commnand. It installs the Strapi app fine, but when I try to run "npm run develop", I get this error:
"Strapi: Middleware "strapi::body": Cannot destructure property 'config' of 'strapi.plugin(...)' as it is undefined."
And the app doesn't start. full error text is as follows:
Middleware "strapi::body": Cannot destructure property 'config' of 'strapi.plugin(...)' as it is undefined.
Error: Middleware "strapi::body": Cannot destructure property 'config' of 'strapi.plugin(...)' as it is undefined.
at instantiateMiddleware (/Users/davit/Github/my-project/node_modules/#strapi/strapi/lib/services/server/middleware.js:12:11)
at resolveMiddlewares (/Users/davit/Github/my-project/node_modules/#strapi/strapi/lib/services/server/middleware.js:56:18)
at registerApplicationMiddlewares (/Users/davit/Github/my-project/node_modules/#strapi/strapi/lib/services/server/register-middlewares.js:66:29)
at async Object.initMiddlewares (/Users/davit/Github/my-project/node_modules/#strapi/strapi/lib/services/server/index.js:99:7)
at async Strapi.bootstrap (/Users/davit/Github/my-project/node_modules/#strapi/strapi/lib/Strapi.js:445:5)
at async Strapi.load (/Users/davit/Github/my-project/node_modules/#strapi/strapi/lib/Strapi.js:457:5)
at async Strapi.start (/Users/davit/Github/my-project/node_modules/#strapi/strapi/lib/Strapi.js:198:9)
Would appreciate any help regarding this issue.
Got the same exception when yarn develop.
Make sure you have right version range for node
node -v if not use nvm use 14.19.1 (or above)
Go to package.json and change strapi version.
from "#strapi/strapi": "^4.3.5" to "#strapi/strapi": "^4.3.6"
Remove package-lock.json and yarn.lock
Run npm install or/and yarn install
I had also posted this question in Strapi forums and it turns out that the problem was with Strapi 4.3.5. They advised updating to 4.3.6 as this issue had been hotfixed. I can confirm that this issue no longer exists on Strapi 4.3.6.

Github Probot create-probot-app: 'Cannot POST /' (404) response to webhook request

Testing out the npx create-probot-app; tried with each of the starters and the same problem exists.
I create, build, and run the app, and then configure and install the app on github, I am able to receive webhook events but I'm seeing my local app respond with a 404.
smee receives the event
error: Error: cannot POST / (404)
ERROR (server): Not Found
Error: Not Found
at Request.callback (/Users/X/Projects/Y/compiler/githubapp/x-bot/node_modules/superagent/lib/node/index.js:884:15)
at IncomingMessage.<anonymous> (/Users/X/Projects/Y/compiler/githubapp/x-bot/node_modules/superagent/lib/node/index.js:1127:20)
at IncomingMessage.emit (events.js:326:22)
at IncomingMessage.EventEmitter.emit (domain.js:483:12)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
status: 404
My index.ts:
export = (app: Probot) => {
app.on("issues.opened", async (context) => {
const issueComment = context.issue({
body: "Thanks for opening this issue!",
});
await context.octokit.issues.createComment(issueComment);
});
// For more information on building apps:
// https://probot.github.io/docs/
// To get your app running against GitHub, see:
// https://probot.github.io/docs/development/
};
I've checked that my environment variables appear to be setup correctly in .env
In sum, github is sending a webhook, smee is receiving it, but my local app is responding with 404: cannot post /
Not able to get the example app to process webhook events due to what appears to be a routing issue. Anyone encountered this before?
Make sure you don't have any other applications running on Port 3000. Create React App uses 3000 by default and can cause the error you are describing.
One of the possible reasons could be that your GitHub App does not have privileges to take that action. Would it be possible that your GitHub App is missing the 'issues' privilege setting? (https://docs.github.com/en/rest/reference/permissions-required-for-github-apps#permission-on-issues)

Wercker Firebase Deployment issue

I am trying automate Deployment to Firebase Hosting via Wercker and I am continously getting this error.
Following this tutorial
https://medium.com/#pradeep1991singh/integrate-wercker-with-bitbucket-firebase-and-slack-7eb3bc38543d
Stack Trace
> export WERCKER_STEP_ROOT="/pipeline/script-5ea4a2c6-b11f-4972-991a-eec61b3d43af"
export WERCKER_STEP_ID="script-5ea4a2c6-b11f-4972-991a-eec61b3d43af"
export WERCKER_STEP_OWNER="wercker"
export WERCKER_STEP_NAME="script"
export WERCKER_REPORT_NUMBERS_FILE="/report/script-5ea4a2c6-b11f-4972-991a-eec61b3d43af/numbers.ini"
export WERCKER_REPORT_MESSAGE_FILE="/report/script-5ea4a2c6-b11f-4972-991a-eec61b3d43af/message.txt"
export WERCKER_REPORT_ARTIFACTS_DIR="/report/script-5ea4a2c6-b11f-4972-991a-eec61b3d43af/artifacts"
source "/pipeline/script-5ea4a2c6-b11f-4972-991a-eec61b3d43af/run.sh" < /dev/null
[2017-08-15T13:38:45.071Z] ----------------------------------------------------------------------
[2017-08-15T13:38:45.076Z] Command: /usr/local/bin/node /usr/local/bin/firebase deploy --project --token --debug
[2017-08-15T13:38:45.076Z] CLI Version: 3.9.2
[2017-08-15T13:38:45.076Z] Platform: linux
[2017-08-15T13:38:45.076Z] Node Version: v7.10.1
[2017-08-15T13:38:45.077Z] Time: Tue Aug 15 2017 13:38:45 GMT+0000 (UTC)
[2017-08-15T13:38:45.077Z] ----------------------------------------------------------------------
[2017-08-15T13:38:45.091Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2017-08-15T13:38:45.091Z] > no authorization credentials were supplied or found
⚠ Your CLI authentication needs to be updated to take advantage of new features.
⚠ Please run firebase login --reauth
[2017-08-15T13:38:45.093Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"]
[2017-08-15T13:38:45.093Z] > no authorization credentials were supplied or found
The Issue was related to the Wercker.yml file. The Step was not defined properly and it seems the environment variable wasnt getting read properly.
Steps to narrow down the issue
Log out of Fire base on local and then try to perform a firebase list - should get an error
try same with --token passing token and will get a list of all the valid projects if token is valid.
Take the valid Project name and token and then hardcode it in yml and try once to make sure the build executes properly
Finally when all are working , expose as protected variables and everything works like a charm!!.

basic React Native SQLite script returning undefined which causes error

I'm trying to learn to use react-native-sqlite-storage as described on this page here:
https://github.com/andpor/react-native-sqlite-storage
I am working on a windows machine trying to build an android app. I have the following code:
import SQLite from 'react-native-sqlite-storage';
function errorCB(err) {
console.log("SQL Error: " + err);
}
function successCB() {
console.log("SQL executed fine");
}
function openCB() {
console.log("Database OPENED");
}
var db = SQLite.openDatabase("test.db", "1.0", "Test Database", 200000, openCB, errorCB);
db.transaction((tx) => {
tx.executeSql('SELECT * FROM Employees a, Departments b WHERE a.department = b.department_id', [], (tx, results) => {
console.log("Query completed");
});
});
export default 1;
When I run this, I get the error
undefined is not an object (evaluating
'NativeModules["SQLite"][method]')
The error is happening on the line var db = SQLite.openDatabase("test.db", "1.0", "Test Database", 200000, openCB, errorCB);
I suspect the reason the error is happening is because SQLite expects the existence of a database before you can actually open it. However, I do not see any instructions in the link above on how to create a database with react-native-sqlite-storage, so I'm not sure if my assumption is correct. Additionally, I assume I'd need to have a table for Employees, but again, the link above didn't explicitly state examples on how to create one. SO I don't know if my assumption is correct.
So how do I get SQLite.openDatabase() command to work?
More information
I deleted my project. Then I tried to re-install everything again, this time closely following the installation instructions for sqlite storage for android as mentioned on the andpor's github instructions (ie, modifying gradle files, updating MainApplication class etc...). Once I did that, running the command react-native run-android from the CLI causes this build error:
ERROR EPERM: operation not permitted, lstat 'C:\Users\John
Lai\Projects\ReactNative\myapp\android\app\build\intermediates\exploded-aar\myapp\realm\unspecified\jars\classes.jar'
{"errno":-4048,"code":"EPERM","syscall":"lstat","path":"C:\Users\John
Lai\Projects\ReactNative\myapp\android\app\build\intermediates\exploded-aar\myapp\realm\unspecified\jars\classes.jar"}
Error: EPERM: operation not permitted, lstat 'C:\Users\John
Lai\Projects\ReactNative\myapp\android\app\build\intermediates\exploded-aar\myapp\realm\unspecified\jars\classes.jar'
at Error (native)
I tried running this command as a regular user and as an administrator, and still the same issue.
More Information 2
I deleted my project. Then I did npm install for all my projects. Then I tried the commands rnpm link and react-native link react-native-sqlite-storage, both of which gave this error:
ERR! It seems something went wrong while linking. Error: spawn UNKNOWN
Please file an issue here: https://github.com/rnpm/rnpm/issues
So now the project won't even build. Any ideas?
the problem is the library is not linked
to link they suggest two ways
with pod (advanced)
with rnpm link (easy) but this command is deprecated
so to link the library you should use the
react-native link react-native-sqlite-storage
this command is equal to rnpm link but not deprecated
if automatic build failing try with manual linking for iOS manually linking ios and android manually linking android
lstat command error is generating on windows due to permission issues or npm version issues.
You can do 2 things to pass this.
1.Open terminal in admin mode .
2.upgrade/degrade npm version
For plugin installation, configure manually
You need change MainApplication.java with:
import org.pgsqlite.SQLitePluginPackage;
and
in getPackages:
new SQLitePluginPackage()

Is there a way to get version from package.json in Meteor code?

This answer explains how to read the package.json "version" from a npm started application. Is there an env variable in Meteor (1.3+) with this info?
Well, there is not npm_package_version environment value in process object.
But you get the value of version using following code :
var pjson = require('/package.json');
console.log(pjson.version); // This will print the version

Resources