Fetching transactions of an account result in an internal server error /v2/accounts/:account_id/transactions - coinbase-api

I receive an Internal Server Error when requesting endpoint: /v2/accounts/xx/transactions
First I am getting all accounts:
GET https://api.coinbase.com/v2/accounts?limit=100
Then I iterate over all account ids and request the transactions. But for the following ids I get an internal server error:
Request:
GET https://api.coinbase.com/v2/accounts/7176ad81-fb91-5d22-9e50-7cd82030d912/transactions?limit=100&order=asc
Response:
500 Internal Server Error {"status":500,"error":"Internal Server Error"}
&
Request:
GET https://api.coinbase.com/v2/accounts/19ffd08f-f713-5d52-9636-ebfdcf5d6d36/transactions?limit=100&order=asc
Response:
500 Internal Server Error {"status":500,"error":"Internal Server Error"}
The requested account id is two times Bitcoin:
{
id: '7176ad81-fb91-5d22-9e50-7cd82030d912',
type: 'wallet',
code: 'BTC',
info: {
id: '7176ad81-fb91-5d22-9e50-7cd82030d912',
name: 'BTC Wallet',
primary: true,
type: 'wallet',
currency: [Object],
balance: [Object],
created_at: '2015-11-17T13:19:13Z',
updated_at: '2020-09-15T02:24:51Z',
resource: 'account',
resource_path: '/v2/accounts/7176ad81-fb91-5d22-9e50-7cd82030d912',
allow_deposits: true,
allow_withdrawals: true,
},
};
&
{
id: '19ffd08f-f713-5d52-9636-ebfdcf5d6d36',
name: 'BTC Wallet',
primary: true,
type: 'wallet',
currency: {
code: 'BTC',
name: 'Bitcoin',
color: '#F7931A',
sort_index: 100,
exponent: 8,
type: 'crypto',
address_regex:
'^([13][a-km-zA-HJ-NP-Z1-9]{25,34})|^(bc1([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{39}|[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{59}))$',
asset_id: '5b71fc48-3dd3-540c-809b-f8c94d0e68b5',
slug: 'bitcoin',
},
balance: { amount: '0.00000000', currency: 'BTC' },
created_at: '2017-09-08T17:59:20Z',
updated_at: '2021-10-06T03:42:42Z',
resource: 'account',
resource_path: '/v2/accounts/19ffd08f-f713-5d52-9636-ebfdcf5d6d36',
allow_deposits: true,
allow_withdrawals: true,
};
Edit: we are now also seeing errors on:
GET https://api.coinbase.com/v2/accounts/a8263795-f4e5-55e5-92a0-bce21cef5e23/transactions?limit=100&order=asc 500 Internal Server Error {"status":500,"error":"Internal Server Error"}
GET https://api.coinbase.com/v2/accounts/26b3496c-275c-5ffd-b931-3f75e9c59a9f/transactions?limit=100&order=asc 500 Internal Server Error {"status":500,"error":"Internal Server Error"}
It does not error on other account ids.
Can someone from Coinbase fix this please?

Related

Why is my mongoose populate query throwing "Cannot populate path because it is not in your schema" error?

I'm building a form management program but right now I'm just trying to build a queue system to handle all the forms when they're assigned to someone.
when I call this first function, it should populate the elements of the activeWork array by pulling from each collection that the entries reference, there are several collections that could be referenced in active work, so I'm trying to use the collection type field to determine what collection to pull from, I don't know if I formatted any of this correctly because its my first time building any of this.
import statesPersons from "./statesPersons.schema.js";
export async function getStatesPersonsActiveWorkByProfileId(req, res){
try{
const { profileId } = req.params
const data = await statesPersons.find({profileId})
.populate('statesPersons.activeWork.referenceId')
return res.send({
message: "success",
data: data,
status: 200 })
}catch(e) {
console.error(e.message)
return res.send({
message: "couldn't fetch active work",
data: null,
status: 500 })
}
}
Here is the schema for statesPersons, the collection where active work is stored.
import mongoose, {model, Schema} from "mongoose";
const activeWorkSchema = new Schema({
active: Boolean,
collectionType: {
type: String,
enum: ['messages'],
},
referenceId: {
type: Schema.Types.ObjectId,
refPath: "statesPersons.activeWork.collectionType"
},
sentBy: {
type: Schema.Types.String,
ref: "statesPerson",
},
sentTo: {
type: Schema.Types.String,
ref: "statesPerson",
},
timeRecived: Date,
dueDate: Date,
subject: String,
viewed: Boolean,
content: {},
})
const statesPersonsSchema = new Schema({
profileId:{
type: String,
required: true,
unique: true
},
department: {
type: String,
required: true,
index: true,
},
firstName: String,
lastName: String,
location: String,
org: String,
title: String,
jobDescription: String,
email: {
type: String,
lowercase: true,
},
phoneNumber: String,
activeWork: [activeWorkSchema],
emailList: [String],
jobAssignments: [String],
affiantInfo: {
affiantInfoTitle: String,
affiantInfoExperience: String,
},
assessments: [
{
assessdBy: {
type: Schema.Types.ObjectId,
ref: "statesPerson",
},
dueDate: Date,
questions: {},
},
],
});
export default mongoose.model("statesPersons", statesPersonsSchema);
When I make a query, I get:
Cannot populate path statesPersons.activeWork.referenceId because it is not in your schema. Set the strictPopulate option to false to override.
I don't know if I formatted my populate correctly or if the problem is in my schema,

A Discord Bot Embed Error: DiscordAPIError: Cannot send an empty message

I've tried writing a discord bot, nearly finished it but this error just appeared and I don't know what's wrong with the code.
The Error:
DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (C:\Users\user\OneDrive\Desktop\discordbot\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\user\OneDrive\Desktop\discordbot\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
at async TextChannel.send (C:\Users\user\OneDrive\Desktop\discordbot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:176:15) {
method: 'post',
path: '/channels/991019562625552466/messages',
code: 50006,
httpStatus: 400,
requestData: {
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
},
files: []
}
}
The code:
module.exports = {
name: 'command',
description: "Embeds!",
execute(message, args, Discord) {
const newEmbed = new Discord.MessageEmbed()
.setColor('#FF0000')
.setTitle('This is a title.')
.setURL('https://www.youtube.com')
.setDescription('This is an embed.')
.addFields(
{name: 'Field 1', value: 'Text 1'},
{name: 'Field 2', value: 'Text 2'},
{name: 'Field 3', value: 'Text 3'}
)
.setImage('https://upload.wikimedia.org/wikipedia/commons/9/9a/Gull_portrait_ca_usa.jpg')
message.channel.send(newEmbed);
}
}
What's the problem?
As of discord.js v13 embeds are sent via the MessageOptions object passed to the send method.
Updated code would be:
message.channel.send({embeds: [newEmbed]});
Documentation:
BaseGuildTextChannel#send takes
<MessageOptions> extends <BaseMessageOptions>

Mongoose ValidationError: Product validation failed: CountInStock: Path `CountInStock` is required

I am a beginner to React.I am working in MERN stack project and I am following this tutorial. In my case, connection to the DB was success. However, I was unable to display products in my Home screen and when I tried with this link http://localhost:5000/api/seed nodemon app get crashed and display this error.
(node:28916) [MONGODB DRIVER] Warning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.
(Use `node --trace-warnings ...` to show where the warning was created)
D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\document.js:2965
this.$__.validationError = new ValidationError(this);
^
ValidationError: Product validation failed: CountInStock: Path CountInStock is required.
at model.Document.invalidate (D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\document.js:2965:32)
at D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\document.js:2754:17
at D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\schematype.js:1333:9
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
errors: {
CountInStock: ValidatorError: Path CountInStock is required.
at validate (D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\schematype.js:1330:13)
at SchemaNumber.SchemaType.doValidate (D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\schematype.js:1314:7)
at D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\document.js:2746:18
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
properties: {
validator: [Function (anonymous)],
message: 'Path CountInStock is required.',
type: 'required',
path: 'CountInStock',
value: undefined
},
kind: 'required',
path: 'CountInStock',
value: undefined,
reason: undefined,
[Symbol(mongoose:validatorError)]: true
}
},
_message: 'Product validation failed'
}
[nodemon] app crashed - waiting for file changes before starting...
Here is my Schema:
import mongoose from 'mongoose';
const productSchema = new mongoose.Schema(
{
name: { type: String, required: true, unique: true },
slug: { type: String, required: true, unique: true },
image: { type: String, required: true },
brand: { type: String, required: true },
category: { type: String, required: true },
description: { type: String, required: true },
price: { type: Number, required: true },
CountInStock: { type: Number, required: true },
rating: { type: Number, required: true },
numReviews: { type: Number, required: true },
},
{
timestamps: true,
}
);
const Product = mongoose.model('Product', productSchema);
export default Product;
Here is my server.js:
import express from 'express';
import mongoose from 'mongoose';
import dotenv from 'dotenv';
import seedRouter from './routes/seedRoutes.js';
import productRouter from './routes/ProductRoutes.js';
dotenv.config();
mongoose
.connect(process.env.MONGODB_URI)
.then(() => {
console.log('connected to db');
})
.catch((err) => {
console.log(err.message);
});
const app = express();
app.use('/api/seed', seedRouter);
app.use('/api/products', productRouter);
const port = process.env.PORT || 5000;
app.listen(port, () => {
console.log(`server at http://localhost:${port}`);
});
And Here is my seedRoutes.js file :
import express from 'express';
import Product from '../models/productModel.js';
import data from '../data.js';
const seedRouter = express.Router();
seedRouter.get('/', async (req, res) => {
await Product.remove({});
const createdProducts = await Product.insertMany(data.products);
res.send({ createdProducts });
});
export default seedRouter;
And my data.js file :
const data = {
products: [
{
name: 'Nike Soccer Football',
slug: 'nike-soccer-football',
category: 'Shoes',
image: '/images/p1.jpg',
price: 120,
countInStock: 10,
brand: 'Nike',
rating: 4.5,
numReviews: 10,
description: 'high quality pair of shoes',
},
{
name: 'Adidas Soccer Football',
slug: 'adidas-soccer-football',
category: 'Shoes',
image: '/images/p2.jpg',
price: 250,
countInStock: 0,
brand: 'Adidas',
rating: 4.0,
numReviews: 10,
description: 'high quality pair of shoes',
},
{
name: 'Nike Slim Pant',
slug: 'nike-slim-pant',
category: 'Pants',
image: '/images/p3.jpg',
price: 65,
countInStock: 5,
brand: 'Nike',
rating: 4.5,
numReviews: 14,
description: 'high quality product',
},
{
name: 'Adidas Fit Pant',
slug: 'Adidas-fit-pant',
category: 'Pants',
image: '/images/p4.jpg',
price: 25,
countInStock: 15,
brand: 'Puma',
rating: 4.5,
numReviews: 10,
description: 'high quality pair of shoes',
},
],
};
export default data;
Can I know the error that I have done here? Is it regarding the file type that I have imported in server.js file?
I think it is rather a typo. You have CountInStock in the schema definition, but countInStock in your data file. Javascript object keys are case-sensitive and therefore the case should match.

ExtJS 4.2 - Internal Server Error 500 When Loading Store

I keep on getting an internal server 500 error every time I attempt to load my store. I am currently trying to connect to our API endpoint that contains the data that I need. This is the error I'm getting every time (FYI, checking the 'Accept' Header, it seems it's empty. I am not sure how I can have an application/json there to correctly connect to it):
My Store is setup like this:
Ext.define('EcommBackoffice.store.TierCapacity', {
extend: 'Ext.data.Store',
model: 'EcommBackoffice.model.TierCapacityModel',
storeId: 'tier-capacity-id',
autoLoad: true,
sorters: [{
property: 'name',
direction: 'ASC'
}],
proxy: {
type: 'rest',
url: EcommBackoffice.Global.getAPIEndPoints().tier_capacity + '?siteCode=bgp88',
reader: {
type: 'json',
root: ''
},
listeners: {
exception: function(proxy, response, op) {
if (response.status === 403 || response.status === 401) return; /*skip this exception handler and check App exception handler*/
Ext.Msg.alert('ERROR', response.responseText + ' ' + response.statusText);
}
}
}
});
And my model like this:
Ext.define('EcommBackoffice.model.TierCapacityModel', {
extend: 'Ext.data.Model',
fields: [{
name: 'id'
}, {
name: 'paymentOption',
type: Ext.data.SortTypes.asUCString
}, {
name: 'tier',
type: Ext.data.SortTypes.asUCString
}, {
name: 'media',
type: Ext.data.SortTypes.asUCString
}, {
name: 'channels',
type: Ext.data.SortTypes.asUCString
}]
});
The API contains something like this:
[{
"name": "DEBIT",
"tiers": [{
"name": "Default",
"media": [{
"name": "OFFICE",
"channels": [{
"name": "CHANNEL-001",
"currentVolume": 0,
"maxVolume": 0,
"yesterdayVolume": 0
}]
}]
}]
}]
Moreover, I am a bit unfamiliar with setting up the models and stores. I am assuming that is where I'm missing something. Am I structuring the model correctly based on the API response? I tried reading the docs, but I still can't wrap my head around it.
Error Code 500 tells :
The server encountered an unexpected condition which prevented it from fulfilling the request.
As I can see that while processing code at your Java end , you are getting NullPointerException .
So when an unexpected exception occurs , Http 500 error code is thrown which is shown on your browser. This error code has nothing to be done from client side.
The error 500 is not an ExtJS issue. It's a backend issue. You should check what backend technologies you use and add these to the tags to get any help.
checking the 'Accept' Header, it seems it's empty. I am not sure how I can have an application/json there to correctly connect to it)
proxy: {
headers: {
Accept: 'application/json'
},

Unhandled Rejection SequelizeDatabaseError

I am working with Sequelize and I'm trying to insert one row into my User Column. However, I keep getting the following error:
Unhandled rejection SequelizeDatabaseError: Invalid object name 'User'.
I am connecting to a MSSQL server. I know that I have the basic connection right because I can run sequelize's plain queries via sequelize.query without issue. My suspicion is that I'm not specifying the schema or database correctly.
My model definition:
var user = sequelize.define("User", {
ID: {
type: Sequelize.INTEGER,
unique: true,
autoIncrement: true
},
FirstName: {
type: Sequelize.STRING
},
LastName: {
type: Sequelize.STRING
},
CreateDate: {
type: Sequelize.DATE
},
UpdateDate: {
type: Sequelize.DATE
}
},{
tableName: 'User',
timestamps: false,
freezeTableName: true
});
My attempt to use the model to create/INSERT a row into my pre-existing database.
User.schema('Core');
User.create({ ID: '1', FirstName: 'Bobert', LastName: 'Jones'}).then(function(user) {
console.log(user.get({
plain: true
}))
});
When I used Sequelize's plain SQL to accomplish this I DID have to include the schema aka "insert into Core.User". Am I not specifying the schema correctly? I have tried adding it to my initial connection definition by adding "schema: 'Core'," before dialectOptions.
you can specify schema in your sequelize constructor:
var sequelize = new Sequelize("db",
"user",
"pass", {
host: "localhost",
port: "1206",
dialect: "mssql",
define: {
schema: "core"
}
});
However, according to their code what you are doing appears correct. In the sequelize constructor you can also turn logging on (logging: true). Logging should output the exact sql that is being constructed.

Resources