I know this and this post both have similar titles but the solution to both is not working for me.
As you can see in my code below I've used Intents.FLAGS.GUILD_MESSAGES to create the client variable but it doesn't give any output in my console when I do the /ping command that I made. /ping however is available in when typing "/" in chat.
const { clientId, token, testGuildId } = require('./config.json');
const Discord = require('discord.js');
const fs = require('fs');
const { REST } = require('#discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const client = new Discord.Client({
intents: [
Discord.Intents.FLAGS.GUILDS,
Discord.Intents.FLAGS.GUILD_MESSAGES,
Discord.Intents.FLAGS.DIRECT_MESSAGES,
],
});
const commandFiles = fs.readdirSync(`./Commands/commandScripts`).filter(file => file.endsWith(".js"));
//for
const commandsArray = [];
client.commandsArray = new Discord.Collection();
for (const file of commandFiles){
const newCommand = require(`./Commands/commandScripts/${file}`);
commandsArray.push(newCommand.data.toJSON());
client.commandsArray.set(newCommand.data.name, newCommand);
}
client.once('ready', async () => {
const rest = new REST({
version: "9"
}).setToken(token);
(async () => {
try {
if(process.env.ENV === "production"){
await rest.put(Routes.applicationCommands(clientId), {
body: commandsArray,
});
console.log("Successfully registered commands globally.");
} else {
var temp = await rest.put(Routes.applicationGuildCommands(clientId, testGuildId), {
body: commandsArray,
});
console.log(temp);
console.log("Successfully registered commands locally.");
}
} catch (err) {
if(err) console.error(err);
}
})();
console.log(`[${time}] *** Bot Is Ready On Discord!`);
});
client.on('interactionCreate', async interaction => {
console.log(interaction);
});
client.on("messageCreate", (message) => {
console.log(message.content);
})
client.login(token);
My package.json:
{
"name": "excavator",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"#discordjs/builders": "^0.12.0",
"#discordjs/opus": "^0.3.3",
"#discordjs/rest": "^0.3.0",
"axios": "^0.21.1",
"discord-api-types": "^0.27.3",
"discord.js": "^12.5.3",
"ffmpeg-static": "^4.2.7",
"fs": "0.0.1-security",
"mongoose": "^5.13.14",
"path": "^0.12.7",
"simple-youtube-api": "^5.2.1",
"yt-search": "^2.5.1",
"ytdl-core": "^4.4.5",
"ytdl-core-discord": "^1.2.5"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "ExcanatorGames",
"license": "ISC"
}
Figured out the problem. I needed to uninstall discord.js and reinstall discord.js
Related
This question already has an answer here:
message.content doesn't have any value in Discord.js
(1 answer)
Closed 3 months ago.
I'm following this tutorial: https://www.youtube.com/watch?v=qv24S2L1N0k&t=1s
the bot is working in the terminal, but not on the Discord Server.
bot.js:
require('dotenv').config()
const Discord = require('discord.js')
const client = new Discord.Client()
client.on('ready', () => {
console.log('Our bot is ready to go!!!')
})
client.login(process.env.BOT_TOKEN)
client.on("message", msg => {
if(msg.content === 'ping'){
msg.channel.send("Not tagged")
}
})
package.json
{
"name": "bot_development",
"version": "1.0.0",
"description": "",
"main": "bot.js",
"scripts": {
"start": "node bot.js",
"devStart": "nodemon bot.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"discord.js": "^12.5.3",
"dotenv": "^8.2.0",
"node": "^16.18.1"
},
"devDependencies": {
"nodemon": "^2.0.20"
}
}
I've tried with
const client = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES"]})
and I've tried "messageCreate" instead of "message", like this:
require('dotenv').config()
const Discord = require('discord.js')
const client = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES"]})
client.on('ready', () => {
console.log('Our bot is ready to go!!!')
})
client.login(process.env.BOT_TOKEN)
client.on("messageCreate", msg => {
if(msg.content === 'ping'){
msg.channel.send("Not tagged")
}
})
Is there any problem outside of my code? I've done the rest of the configuration at the dev portal in the tutorial.
client.on("message", msg => {
if(msg.content === "ping"){
//try msg.reply("pong") if the code below does not work
msg.channel.send("Not tagged");
}
})
try changing createMessage to 'message'
I am trying to seed my db and this issue is preventing that. It keeps saying "Inventory.create is not a function
at seed". I am not sure if this is a syntactical issue, a logistical problem or even a dependency issue so please point me in the wrong direction.
The tech stack that I am using is Express, Node.js, Sequelize, PostgreSQL
My files are structured as such:
--script
-seed.js
--server
-api
-db
-Model.js
-index.js
-db.js
-app.js
-index.js
Model.js
const db = require('./db');
const Model = db.define('model', {
name: {
type: Sequelize.STRING,
allowNull: false,
},
total: {
type: Sequelize.FLOAT,
allowNull: false,
},
})
module.export = Model;
index.js
const db = require('./db')
const Inventory = require('./Inventory')
module.exports = {
db,
models: {
Inventory,
},
}
db.js
const Sequelize = require('sequelize')
const pkg = require('../../package.json')
const databaseName = pkg.name + (process.env.NODE_ENV === 'test' ? '-test' : '')
if(process.env.LOGGING === 'true'){
delete config.logging
}
if(process.env.DATABASE_URL){
config.dialectOptions = {
ssl: {
rejectUnauthorized: false
}
};
}
const db = new Sequelize(
process.env.DATABASE_URL || `postgres://localhost:5432/${databaseName}`, {
logging: false,
})
module.exports = db
seed.js
'use strict'
const {db, models: {Model}} = require('../server/db')
async function seed() {
await db.sync({ force: true })
console.log('db synced!')
// Creating Inventory
const stock = await Promise.all([
Model.create({ name: 'First', amount: 200 }),
Model.create({ name: 'Second', amount: 200 }),
])
console.log(`seeded successfully`)
}
async function runSeed() {
console.log('seeding...')
try {
await seed()
} catch (err) {
console.error(err)
process.exitCode = 1
} finally {
console.log('closing db connection')
await db.close()
console.log('db connection closed')
}
}
if (module === require.main) {
runSeed()
}
module.exports = seed
I included this just in case
package.json
{
"name": "ShopifyInventory",
"version": "1.0",
"description": "Simple backend heavy app for inventory management",
"main": "app.js",
"scripts": {
"build": "webpack",
"build:dev": "npm run build -- --watch --mode=development",
"seed": "node script/seed.js",
"start": "node server"
},
"dependencies": {
"axios": "^0.21.1",
"bcrypt": "^5.0.0",
"compression": "^1.7.3",
"express": "^4.18.1",
"history": "^4.9.0",
"jsonwebtoken": "^8.5.1",
"morgan": "^1.9.1",
"pg": "^8.7.3",
"pg-hstore": "^2.3.4",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-router-dom": "^6.3.0",
"sequelize": "^6.19.2"
},
"author": "Galilior :)",
"devDependencies": {
"#babel/core": "^7.17.12",
"#babel/preset-react": "^7.17.12",
"babel-loader": "^8.2.5",
"webpack": "^5.72.1",
"webpack-cli": "^4.9.2"
}
}
All right. So. I have a really basic API running on Node.js. I'm also using MongoDB as a database and I'm using Mongoose to build queries. My problem is that I'm trying to query for a sorted list of data using using the mongoose 'sort' method. For some reason the method isn't working and Node tries to use the Javascript sort method instead. This is my code:
Query handling:
const mongoose = require("mongoose");
const express = require("express");
const Tour = require("../models/tourModel.js");
exports.getAllTours = async (req, res) => {
try {
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const queryObject = { ...req.query };
const excludedFields = ["page", "sort", "limit", "fields"];
excludedFields.forEach((el) => delete queryObject[el]);
let queryStr = JSON.stringify(queryObject);
queryStr = queryStr.replace(/\b(gte|gt|lte|lt)\b/g, (match) => `$${match}`);
let query = await Tour.find(JSON.parse(queryStr));
// query.sort((a, b) => (a[req.query.sort] > b[req.query.sort] ? 1 : -1));
if (req.query.sort) {
query = query.sort(req.query.sort);
}
const tours = await query;
res.status(200).json({
status: "success",
data: { tours },
});
} catch (error) {
res.status(400).json({ status: "failed", message: error.message });
}
};
Router
const tourController = require("../controllers/tourController");
const router = express.Router();
// router.param("id", tourController.checkID);
router
.route("/")
.get(tourController.getAllTours)
.post(tourController.createTour);
router
.route("/:id")
.get(tourController.getTourById)
.patch(tourController.updateTour)
.delete(tourController.deleteTour);
module.exports = router;
Package.json
"name": "natours",
"version": "1.0.0",
"description": "fdsfd",
"main": "index.js",
"scripts": {
"start:dev": "nodemon server.js",
"start:prod": "nodemon server.js NODE_ENV=production "
},
"author": "me",
"license": "ISC",
"dependencies": {
"dotenv": "^8.2.0",
"express": "^4.17.1",
"mongoose": "^5.12.7",
"morgan": "^1.10.0"
},
"devDependencies": {
"eslint": "^7.25.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.23.2",
"prettier": "^2.2.1"
}
}
When I try to query for 127.0.0.1:3000/api/v1/tours?sort=price,
I get a response
{
"status": "failed",
"message": "The comparison function must be either a function or undefined"
}
I'm a real noob in this so does anyone have any ideas what is causing this or how to fix it?
let query = await Tour.find(JSON.parse(queryStr));
This is the result of your query since await executes the query. If you want to store the query, don't use await
let query = Tour.find(JSON.parse(queryStr));
// query.sort((a, b) => (a[req.query.sort] > b[req.query.sort] ? 1 : -1));
if (req.query.sort) {
query = query.sort(req.query.sort);
}
const tours = await query;
I am using nodemailer with my Firebase Functions (server-side functions) for my React.js project and am getting the error: Error: Client network socket disconnected before secure TLS connection was established... and causing some emails to not be sent out. This is a big issue for this project, as the client can't be missing emails sent from the system. Why am I getting this error and how might I remedy it?
Firebase Function index.js:
"use strict";
import functions = require('firebase-functions');
import admin = require("firebase-admin");
import nodemailer = require('nodemailer');
import { DocumentSnapshot } from 'firebase-functions/lib/providers/firestore';
import { Change, EventContext } from 'firebase-functions';
import { Status } from './common';
admin.initializeApp(functions.config().firebase);
export const onUserCreated = functions.firestore.document('users/{userId}')
.onCreate(async (snap: { data: () => any; }) => {
console.log("Client create heard! Starting inner...")
const newValue = snap.data();
try {
console.log("Started try{}...")
// Template it
const htmlEmail =
`
<div>
<h2>client Sign Up</h2>
`
// Config it
const transporter = nodemailer.createTransport({
host: "smtp.gmail.com",
port: 465,
secure: true,
auth: {
user: functions.config().email.user,
pass: functions.config().email.password
}
})
console.log("transporter = " + transporter)
// Pack it
const mailOptions = {
from: `email123#gmail.com`,
to: 'email123#gmail.com',
replyTo: `${newValue.email}`,
subject: `user sign up`,
text: `A new user sign up with the email of ${newValue.email}.`,
html: htmlEmail
}
// Send it
transporter.sendMail(mailOptions, (err: any) => {
if(err) {
console.error(err);
} else {
console.log("Successfully sent mail with sendMail()!");
}
})
} catch (error) {
console.error(error)
}
});
Functions package.json:
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"serve": "npm run build && firebase emulators:start --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "10"
},
"main": "lib/index.js",
"dependencies": {
"#types/nodemailer": "^6.4.0",
"firebase-admin": "^9.4.1",
"firebase-functions": "^3.11.0",
"nodemailer": "^6.4.16"
},
"devDependencies": {
"firebase-functions-test": "^0.2.3",
"tslint": "^5.12.0",
"typescript": "^3.8.0"
},
"private": true
}
Full error:
In my case the error gone after adding TLS version to nodemailer options:
let transporter = nodemailer.createTransport({
host: 'smtp-server',
port: 25,
tls: {
ciphers : 'SSLv3',
},
});
You should return a promise to avoid unexpected Fuctions behaviour like early termination.
Checking Nodemailer API documentation
I can see that transporter.sendMail returns a promise. So just returning this promise should fix your issue:
export const onUserCreated = functions.firestore.document('users/{userId}')
.onCreate(async (snap: { data: () => any; }) => {
....
return transporter.sendMail(mailOptions)
}
So im trying to deploy a simple twitter like app to HEROKU or MongoDB and i'm currently nailing either. For mongodb I get one out of two outcomes, either a internal server error or the actual code displaying on the browser instead of the app. Since I have two separate folders for each implementation i'm going to post subsequently.
MONGODB
Index.js (This is the server side node code)
const express = require('express');
//Cors permite que cualquiera se comunique con el server.
const cors = require('cors');
const monk = require('monk');
const Filter = require('bad-words');
const rateLimit = require('express-rate-limit');
const filter = new Filter();
const app = express();
const db = monk(process.env.MONGO_URI || 'localhost/meower');
const mews = db.get('mews');
//ORDER MATTERS, WHAT IS FIRST GETS EXECUTED FIRST
app.enable('trust proxy');
app.use(cors());
//any incoming request that is JSON will pass
app.use(express.json());
//server, when you get a request run this function.
app.get('/',(request,response) => {
res.json({
message: 'Meower!'
});
});
app.get('/mews', (req,res) => {
mews
.find()
.then(mews => {
res.json(mews);
});
});
function isvalidmew(mew){
return mew.name && mew.name.toString().trim() !== '' &&
mew.content && mew.content.toString().trim() !== '';
}
//limit the submit rate
app.use(rateLimit({
windowMs: 30 * 1000,
max: 2
}));
//this will wait for incoming data and insert in database
app.post('/mews', (req,res) => {
if(isvalidmew(req.body)){
const mew = {
name: filter.clean(req.body.name.toString()),
content: filter.clean(req.body.content.toString()),
created: new Date()
};
mews
.insert(mew)
.then(createdMew => {
res.json(createdMew);
});
} else {
res.status(422);
res.json({
message:'Hey! Name and Content are required!'
});
}
});
//abre el server en el puerto 5000
app.listen(5000, () => {
console.log('Listening on http://localhost:5000');
});
Client.js
const form = document.querySelector('form');
const loadingElement = document.querySelector('.loading');
const mewsElement = document.querySelector('.mews');
const API_URL = 'http://localhost:5000/mews';
loadingElement.style.display = '';
console.log('hola')
listallmews();
form.addEventListener('submit', (event) => {
event.preventDefault();
const formData = new FormData(form);
//We grab the stuff from the form
const name = formData.get('name');
const content = formData.get('content');
//We put it in an object
const mew = {
name,
content
};
//We send the data to the server
form.style.display = 'none';
loadingElement.style.display = '';
fetch(API_URL, {
method: 'POST',
body: JSON.stringify(mew),
headers : {
'content-type':'application/json'
}
}).then(response => response.json())
.then(createdMew => {
form.reset();
setTimeout(() => {
form.style.display = '';
},30000);
listallmews();
});
});
function listallmews(){
mewsElement.innerHTML = '';
fetch(API_URL)
.then(response => response.json())
.then(mews => {
console.log(mews);
mews.reverse();
mews.forEach(mew =>{
const div = document.createElement('div');
const header = document.createElement('h3');
header.textContent= mew.name
const contents = document.createElement('p')
contents.textContent= mew.content;
const date = document.createElement('small');
date.textContent = new Date(mew.created);
div.appendChild(header);
div.appendChild(contents);
div.appendChild(date);
mewsElement.appendChild(div);
});
loadingElement.style.display = 'none'
});
}
now.json
{
"name": "camitter-api",
"version": 2,
"builds": [
{
"src": "index.js",
"use": "#now/node-server"
}
],
"routes": [
{ "src": "/.*", "dest": "index.js" }
],
"env": {
"MONGO_URI": "#camitter-db"
}
}
and package.json
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"dev": "nodemon index.js"
},
"keywords": [],
"author": "CJ R. <cj#null.computer> (https://w3cj.now.sh)",
"license": "MIT",
"dependencies": {
"bad-words": "^1.6.3",
"cors": "^2.8.4",
"express": "^4.16.3",
"express-rate-limit": "^3.1.1",
"monk": "^6.0.6",
"morgan": "^1.9.1"
},
"devDependencies": {
"nodemon": "^1.18.4"
}
}
And this is the terminal output on implementation. Currently the link shows "internal server error"
Alejandro#DESKTOP-LOJH5G7 MINGW64 ~/Desktop/Programacion/Meower
$ now secrets add camisite mongodb+srv://alenieto:myactualpassword#camisite-irtu2.mongodb.net/test?retryWrites=true&w=majority
[1] 444
Alejandro#DESKTOP-LOJH5G7 MINGW64 ~/Desktop/Programacion/Meower
$ Now CLI 18.0.0
Success! Secret camisite added under alenieto97 [709ms]
$ now -e MONGO_URI=#camisite
Now CLI 18.0.0
? Set up and deploy “~\Desktop\Programacion\Meower”? [Y/n] y
? Which scope do you want to deploy to? Alejandro Nieto
? Found project “alenieto97/meower”. Link to it? [Y/n] n
? Link to different existing project? [Y/n] n
? What’s your project’s name? camisite
? In which directory is your code located? ./
No framework detected. Default project settings:
- Build Command: `npm run now-build` or `npm run build`
- Output Directory: `public` if it exists, or `.`
� Inspect: https://zeit.co/alenieto97/camisite/ei55o9z4q [2s]
✅ Production: https://camisite.now.sh [copied to clipboard] [5s]
� Deployed to production. Run `now --prod` to overwrite later (https://zeit.ink/2F).
� To change the domain or build command, go to https://zeit.co/alenieto97/camisite/settings
[1]+ Done now secrets add camisite mongodb+srv://alenieto:lapata97#camisite-irtu2.mongodb.net/test?retryWrites=true
Alejandro#DESKTOP-LOJH5G7 MINGW64 ~/Desktop/Programacion/Meower
$ cd server
Alejandro#DESKTOP-LOJH5G7 MINGW64 ~/Desktop/Programacion/Meower/server
$ now -e MONGO_URI=#camisite
Now CLI 18.0.0
❗️ The `name` property in now.json is deprecated (https://zeit.ink/5F)
� Inspect: https://zeit.co/alenieto97/camitter/6b76zrggu [3s]
✅ Preview: https://camitter.alenieto97.now.sh [copied to clipboard] [20s]
� To deploy to production (camitter.now.sh), run `now --prod`
❗️ Zero-configuration deployments are recommended instead of a `builds` property in `now.json`. The "Build and Development Settings" in your Project will not apply.
Alejandro#DESKTOP-LOJH5G7 MINGW64 ~/Desktop/Programacion/Meower/server
HEROKU
Here i'm pretty sure im doing something wrong on the index.js or client.js or both. I saw tons of guides and have all the files necesary. When I deploy, the app simply doesn't work. Since I actually tried to adapt the code to work on Heroku I'm pretty sure the problem lies in the code itself. This is The folder:
node_modules
.gitignore
index.js
package_lock.json
client.js
favicon.ico
index.html
loading.gif
styles.css
Procfile
Index.js
const express = require('express');
//Cors permite que cualquiera se comunique con el server.
const cors = require('cors');
const Filter = require('bad-words');
const rateLimit = require('express-rate-limit');
const { Pool, Client } = require('pg');
const port = process.env.PORT;
const connectionString = 'postgres://gvvsunuvtdhxpq:e9d3239ab17ea6f38d0b6303dee62b7704b37574e5eb2783ca7edb868cc7192a#ec2-18-235-20-228.compute-1.amazonaws.com:5432/d7df9kofqifk5b'
const pool = new Pool({
connectionString: connectionString,
})
const filter = new Filter();
const app = express();
//ORDER MATTERS, WHAT IS FIRST GETS EXECUTED FIRST
app.enable('trust proxy');
app.use(cors());
//any incoming request that is JSON will pass
app.use(express.json());
//server, when you get a request run this function.
app.get('/',(request,response) => {
res.json({
message: 'Meower!'
});
});
app.get('/mews', async (req, res) => {
try {
const client = await pool.connect()
const result = await client.query('SELECT * FROM test_table');
const results = { 'results': (result) ? result.rows : null};
res.render('pages/mews', results );
client.release();
} catch (err) {
console.error(err);
res.send("Error " + err);
}
})
function isvalidmew(mew){
return mew.name && mew.name.toString().trim() !== '' &&
mew.content && mew.content.toString().trim() !== '';
}
//limit the submit rate
app.use(rateLimit({
windowMs: 30 * 1000,
max: 2
}));
//this will wait for incoming data and insert in database
app.post('/mews', (req,res) => {
if(isvalidmew(req.body)){
const mew = {
name: filter.clean(req.body.name.toString()),
content: filter.clean(req.body.content.toString()),
created: new Date()
};
mews
.insert(mew)
.then(createdMew => {
res.json(createdMew);
});
} else {
res.status(422);
res.json({
message:'Hey! Name and Content are required!'
});
}
});
app.listen(port, () => {
console.log('Listening on PORT');
});
Client.js
const form = document.querySelector('form');
const loadingElement = document.querySelector('.loading');
const mewsElement = document.querySelector('.mews');
const API_URL = 'https://camisite.herokuapp.com/mews';
loadingElement.style.display = '';
listallmews();
form.addEventListener('submit', (event) => {
event.preventDefault();
const formData = new FormData(form);
//We grab the stuff from the form
const name = formData.get('name');
const content = formData.get('content');
//We put it in an object
const mew = {
name,
content
};
//We send the data to the server
form.style.display = 'none';
loadingElement.style.display = '';
fetch(API_URL, {
method: 'POST',
body: JSON.stringify(mew),
headers : {
'content-type':'application/json'
}
}).then(response => response.json())
.then(createdMew => {
form.reset();
setTimeout(() => {
form.style.display = '';
},30000);
listallmews();
});
});
function listallmews(){
mewsElement.innerHTML = '';
fetch(API_URL)
.then(response => response.json())
.then(mews => {
console.log(mews);
mews.reverse();
mews.forEach(mew =>{
const div = document.createElement('div');
const header = document.createElement('h3');
header.textContent= mew.name
const contents = document.createElement('p')
contents.textContent= mew.content;
const date = document.createElement('small');
date.textContent = new Date(mew.created);
div.appendChild(header);
div.appendChild(contents);
div.appendChild(date);
mewsElement.appendChild(div);
});
loadingElement.style.display = 'none'
});
}
Procfile
web: node index.js
Package.json
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"dev": "nodemon index.js"
},
"keywords": [],
"author": "CJ R. <cj#null.computer> (https://w3cj.now.sh)",
"license": "MIT",
"dependencies": {
"bad-words": "^1.6.3",
"cors": "^2.8.5",
"express": "^4.16.3",
"express-rate-limit": "^3.1.1",
"monk": "^6.0.6",
"morgan": "^1.9.1",
"pg": "^7.18.2"
},
"devDependencies": {
"nodemon": "^1.18.4"
}
}
I appreciate a lot any help to deploy on any of the two platforms, im trying to make the most out of this quarantine and have been trying to solve this for twenty hours straight. Cheers to any isolated folks!
Change index.js file
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Our app is running on port ${ PORT }`);
});
You can also refer https://help.heroku.com/P1AVPANS/why-is-my-node-js-app-crashing-with-an-r10-error