Uncaught (in promise) TypeError: http.Agent is not a constructor - stripe-payments

I am trying to use Stripe. When I tried the code below, 'http.Agent is not a constructor' error thrown.
import Stripe from 'stripe';
const stripe = new Stripe('<my test key>', {
apiVersion: '2022-11-15',
});
Error:
Uncaught (in promise) TypeError: http.Agent is not a constructor
at node_modules/stripe/lib/net/NodeHttpClient.js (NodeHttpClient.js:6:26)
at __require2 (chunk-NNYXQWFV.js?v=619287ea:19:50)
at Stripe.createNodeHttpClient (stripe.js:117:28)
at new Stripe (stripe.js:89:44)
at myStripe (stripe.ts:8:20)
at [lessonid].vue:189:5
at runtime-core.esm-bundler.js:2723:40
at callWithErrorHandling (runtime-core.esm-bundler.js:155:22)
at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:164:21)
at hook.__weh.hook.__weh (runtime-core.esm-bundler.js:2697:29)
Environment:
Node ^17.0.0
stripe ^11.3.0
MacOS
Typescript

Related

Random error in Mumbai: MetaMask - RPC Error: Non-200 status code: '404'

I'm buidiling a DApp with the Polygon testnet (Mumabi). I need to interact with my smart contract calling some method like in the following script
const web3Modal = new Web3Modal()
const connection = await web3Modal.connect()
const provider = new ethers.providers.Web3Provider(connection)
var tokenContract = new ethers.Contract(nftaddress, NFT.abi ,provider);
const data = await marketContract.fetchItemsCreated()
However, I sometimes get this error
MetaMask - RPC Error: Non-200 status code: '404'
code: -32603
data:
error: "Not Found"
message: "Not Found"
statusCode: 404
I failed to figure out in which case this error occurs: It looks like to be happening random.
I couldn't find any reference to this specific error.
I really appreciate any suggestion
I think the RPC url for deploying smartcontracts is diffrent from RPC url set on metamask wallet for matic mumbai network try to use same RPC url. It solved my issue.

ERROR:#google-cloud/error-reporting: Encountered an error while attempting to transmit an error to the Stackdriver Error Reporting API

I want to add an error reporting in a nodejs app which will report errors to stackdriver api on GCP. I have followed all the steps required to report an error but when I report error I'm getting an error
ERROR:#google-cloud/error-reporting: Encountered an error while attempting to transmit an error to the Stackdriver Error Reporting API. ApiError: User not authorized.
The entire error stack is
ERROR:#google-cloud/error-reporting: Encountered an error while attempting to transmit an error to the Stackdriver Error Reporting API. ApiError: User not authorized.
at new ApiError (/Applications/XAMPP/xamppfiles/htdocs/web-dev/kiddopia.com/node_modules/#google-cloud/common/build/src/util.js:59:15)
at Util.parseHttpRespBody (/Applications/XAMPP/xamppfiles/htdocs/web-dev/kiddopia.com/node_modules/#google-cloud/common/build/src/util.js:194:38)
at Util.handleResp (/Applications/XAMPP/xamppfiles/htdocs/web-dev/kiddopia.com/node_modules/#google-cloud/common/build/src/util.js:135:117)
at /Applications/XAMPP/xamppfiles/htdocs/web-dev/kiddopia.com/node_modules/#google-cloud/common/build/src/util.js:434:22
at onResponse (/Applications/XAMPP/xamppfiles/htdocs/web-dev/kiddopia.com/node_modules/retry-request/index.js:214:7)
at /Applications/XAMPP/xamppfiles/htdocs/web-dev/kiddopia.com/node_modules/teeny-request/build/src/index.js:219:13
at processTicksAndRejections (node:internal/process/task_queues:94:5)
My error reporting helper is
const { ErrorReporting } = require('#google-cloud/error-reporting');
module.exports = class ErrorReportHelper {
constructor() {
this.errorReporter = new ErrorReporting({
projectId: 'project-id',
reportMode: 'always',
keyFilename: 'service.json'
});
}
report(message) {
this.errorReporter.report(message);
}
express() {
return this.errorReporter.express();
}
}
Any help appreciated. Thanks

Why am I getting a QueryFailedError when controller method is not calling the db (PostgreSql)?

I'm developing a project in which among other things I have to connect to Binance for retrieving all the trades made by the user and other stuff. Everything was working well until at a certain point (without modifying the existing methods) I started to get an UUID error when I call some method inside a users controller.
In this example, I want to get my Binance Info and I'm calling the following endpoint:
#hasRoles(UserRole.ADMIN, UserRole.USER)
#UseGuards(JwtAuthGuard)
#Get("/binanceAccount")
async account()
{
console.log("flag");
const response = await this.userService.userBinanceAccInfo();
if(!response.isResponse)
{
this.errorResponse([response.errors.toString()]);
}
return { account: response.accountInfo };
}
It should return the Binance account info and printing the flag but instead of that, I'm getting this error and the flag is not printed in the console. The thing is that I don't know why I'm getting this error even I'm not calling my database inside this or other methods.
[Nest] 55510 - 04/29/2021, 4:57:06 PM [ExceptionsHandler] invalid input syntax for type uuid: "binanceAccount" +6913ms
QueryFailedError: invalid input syntax for type uuid: "binanceAccount"
at new QueryFailedError (/projectPath/node_modules/typeorm/error/QueryFailedError.js:12:28)
at PostgresQueryRunner.<anonymous> (/projectPath/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:248:31)
at step (/projectPath/node_modules/tslib/tslib.js:143:27)
at Object.throw (/projectPath/node_modules/tslib/tslib.js:124:57)
at rejected (/projectPath/node_modules/tslib/tslib.js:115:69)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
For more testing, I tried this and I got the same error as above:
#Get("/binanceAccountTest")
async account1()
{
console.log("test");
}

Unable to fetch and show results of an API on microsoft botframework using nodejs

I am trying to build a bot using microsoft bot framework and nodejs. I have a synchronous programming background and I'm trying to get a grip on nodejs.
While trying to execute an API using axios and give the results of the same API to the user I am getting the following error:
TypeError: Cannot perform 'get' on a proxy that has been revoked
at MainDialog.getSymptoms (C:\Windows\System32\botbuilder-samples\samples\javascript_nodejs\project1\dialogs\mainDialog.js:304:26)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
Code Snippet:
try{
const response = await axios.get('https://covid-19-coronavirus-statistics2.p.rapidapi.com/countriesData', {headers: {
'x-rapidapi-key': '<key>',
'x-rapidapi-host': 'covid-19-coronavirus-statistics2.p.rapidapi.com',
useQueryString: true
}});
// console.log(response.data);
info=response.data;
await context.sendActivity("These are the Symptoms: " + info);
} catch (error) {
console.log(error);
// await context.sendActivity("Sorry, we were not able to complete your request.");
}
This might be a very naive question, but please assist.
Edit 1: Referred and tried the below links, which didn't succeed --
https://github.com/Microsoft/botbuilder-js/issues/606
Bot Framework V4 - TypeError: Cannot perform 'get' on a proxy that has been revoked (tried with request module, axios etc)
https://github.com/howdyai/botkit/issues/1957
https://github.com/howdyai/botkit/issues/1856
Bot framework - unexpected error when call turnContext.sendActivity method inside Cron callback function
use await inside callback (Microsoft Bot Framework v4 nodejs)
The version I am using is microsoft-bot-framework-v4-nodejs

wit ai node messenger.js TypeError: Cannot read property 'Logger' of undefined

I am trying to use wit-node "messenger.js" but once i run it, its giving error logger not found.
https://github.com/asimkh/hellohazzir
Review my code
// Setting up our bot
const wit = new Wit({
accessToken: WIT_TOKEN,
actions,
logger: new log.Logger(log.INFO)
});

Resources