My project doesn't involve any private information, so I don't care about vulnerabilities.
I am certain that the connection between the App/server and the DB is the problem.
I tried to looking on Youtube and on Google, but the answers were outdated or they just didn't work for me. However, connecting to the database with heroku psql (cli) or connecting with pgAdmin4 using db creds and querying, creating tables works fine.
Following this guy's tutorial
https://github.com/ousecTic/pern-deploy-tutorial
Errors:
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
ssl: true,
});
------------------------------------------------------------------------
2022-02-12T11:02:33.058860+00:00 heroku[web.1]: State changed from starting to up
2022-02-12T11:02:34.275213+00:00 app[web.1]: node:internal/process/promises:265
2022-02-12T11:02:34.275240+00:00 app[web.1]: triggerUncaughtException(err, true /* fromPromise */);
2022-02-12T11:02:34.275241+00:00 app[web.1]: ^
2022-02-12T11:02:34.275241+00:00 app[web.1]:
2022-02-12T11:02:34.275241+00:00 app[web.1]: Error: self signed certificate
2022-02-12T11:02:34.275242+00:00 app[web.1]: at TLSSocket.onConnectSecure (node:_tls_wrap:1530:34)
2022-02-12T11:02:34.275242+00:00 app[web.1]: at TLSSocket.emit (node:events:520:28)
2022-02-12T11:02:34.275242+00:00 app[web.1]: at TLSSocket._finishInit (node:_tls_wrap:944:8)
2022-02-12T11:02:34.275243+00:00 app[web.1]: at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:725:12) {
2022-02-12T11:02:34.275243+00:00 app[web.1]: code: 'DEPTH_ZERO_SELF_SIGNED_CERT'
2022-02-12T11:02:34.275243+00:00 app[web.1]: }
-------------------------------------------------------------------------
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
});
------------------------------------------------------------------------------------
2022-02-12T11:19:13.660398+00:00 app[web.1]: { description: 'jhoipjo' } <<console.log()
2022-02-12T11:19:13.681933+00:00 app[web.1]: no pg_hba.conf entry for host "3.86.151.70", user "user", database "database", SSL off
------------------------------------------------------------------------------------
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
ssl: false,
});
------------------------------------------------------------------------------------
2022-02-12T11:58:50.711988+00:00 app[web.1]: /app/node_modules/pg-protocol/dist/parser.js:287
2022-02-12T11:58:50.712007+00:00 app[web.1]: const message = name === 'notice' ? new messages_1.NoticeMessage(length, messageValue) : new messages_1.DatabaseError(messageValue, length, name);
2022-02-12T11:58:50.712008+00:00 app[web.1]: ^
2022-02-12T11:58:50.712009+00:00 app[web.1]:
2022-02-12T11:58:50.712010+00:00 app[web.1]: error: no pg_hba.conf entry for host "3.236.98.211", user "user", database "database", SSL off
2022-02-12T11:58:50.712010+00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:287:98)
2022-02-12T11:58:50.712011+00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2022-02-12T11:58:50.712012+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2022-02-12T11:58:50.712013+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:11:42)
2022-02-12T11:58:50.712014+00:00 app[web.1]: at Socket.emit (node:events:520:28)
2022-02-12T11:58:50.712014+00:00 app[web.1]: at addChunk (node:internal/streams/readable:315:12)
2022-02-12T11:58:50.712014+00:00 app[web.1]: at readableAddChunk (node:internal/streams/readable:289:9)
2022-02-12T11:58:50.712014+00:00 app[web.1]: at Socket.Readable.push (node:internal/streams/readable:228:10)
2022-02-12T11:58:50.712015+00:00 app[web.1]: at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
2022-02-12T11:58:50.712015+00:00 app[web.1]: length: 166,
2022-02-12T11:58:50.712016+00:00 app[web.1]: severity: 'FATAL',
2022-02-12T11:58:50.712016+00:00 app[web.1]: code: '28000',
2022-02-12T11:58:50.712016+00:00 app[web.1]: detail: undefined,
2022-02-12T11:58:50.712017+00:00 app[web.1]: hint: undefined,
2022-02-12T11:58:50.712017+00:00 app[web.1]: position: undefined,
2022-02-12T11:58:50.712017+00:00 app[web.1]: internalPosition: undefined,
2022-02-12T11:58:50.712018+00:00 app[web.1]: internalQuery: undefined,
2022-02-12T11:58:50.712018+00:00 app[web.1]: where: undefined,
2022-02-12T11:58:50.712018+00:00 app[web.1]: schema: undefined,
2022-02-12T11:58:50.712018+00:00 app[web.1]: table: undefined,
2022-02-12T11:58:50.712019+00:00 app[web.1]: column: undefined,
2022-02-12T11:58:50.712019+00:00 app[web.1]: dataType: undefined,
2022-02-12T11:58:50.712019+00:00 app[web.1]: constraint: undefined,
2022-02-12T11:58:50.712019+00:00 app[web.1]: file: 'auth.c',
2022-02-12T11:58:50.712019+00:00 app[web.1]: line: '496',
2022-02-12T11:58:50.712019+00:00 app[web.1]: routine: 'ClientAuthentication'
2022-02-12T11:58:50.712020+00:00 app[web.1]: }
------------------------------------------------------------------------------------
the app was a nodejs blogging app so there was no need for security
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: false,
},
});
Related
const config = require('./config.json');
const logger = require('./utils/logger');
const Discord = require('discord.js');
const Statcord = require("statcord.js");
const { token } = require('./utils/variables.js');
const manager = new Discord.ShardingManager('./index.js', {
token: token,
autoSpawn: false,
totalShards: 5,
respawn: true,
spawnTimeout: -1
});
manager.on('shardCreate', shard => logger.info(`Launching Shard ${shard.id + 1}`, { label: `Neo Shard` }));
manager.spawn(manager.totalShards, 5500, -1);
Thats My Code of My Shard File
And I Run A Dashboard On The Same Instance
This Is The Error
2022-05-07 10:42:48 [info] [Neo Shard] Launching Shard 1
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^
Error [SHARDING_IN_PROCESS]: Shards are still being spawned.
at ShardingManager._performOnShards (C:\Teun\NeoSecurity\node_modules\discord.js\src\sharding\ShardingManager.js:258:75)
at ShardingManager.fetchClientValues (C:\Teun\NeoSecurity\node_modules\discord.js\src\sharding\ShardingManager.js:245:17)
at Shard._handleMessage (C:\Teun\NeoSecurity\node_modules\discord.js\src\sharding\Shard.js:338:22)
at ChildProcess.emit (node:events:527:28)
at emit (node:internal/child_process:938:14)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
(process:5992): GLib-GIO-WARNING **: 10:42:53.218: Unexpectedly, UWP app `Clipchamp.Clipchamp_2.2.12.0_neutral__yxz26nhyzhsrt' (AUMId `Clipchamp.Clipchamp_yxz26nhyzhsrt!App') supports 46 extensions but has no verbs
2022-05-07 10:42:54 [info] [Neo Shard] Launching Shard 2
Dashboard is up and running on port 5003.
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^
Error [SHARDING_IN_PROCESS]: Shards are still being spawned.
at ShardingManager._performOnShards (C:\Teun\NeoSecurity\node_modules\discord.js\src\sharding\ShardingManager.js:258:75)
at ShardingManager.fetchClientValues (C:\Teun\NeoSecurity\node_modules\discord.js\src\sharding\ShardingManager.js:245:17)
at Shard._handleMessage (C:\Teun\NeoSecurity\node_modules\discord.js\src\sharding\Shard.js:338:22)
at ChildProcess.emit (node:events:527:28)
at emit (node:internal/child_process:938:14)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
(process:20872): GLib-GIO-WARNING **: 10:42:58.757: Unexpectedly, UWP app `Clipchamp.Clipchamp_2.2.12.0_neutral__yxz26nhyzhsrt' (AUMId `Clipchamp.Clipchamp_yxz26nhyzhsrt!App') supports 46 extensions but has no verbs
2022-05-07 10:42:59 [info] [Neo Shard] Launching Shard 3
node:events:505
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::5003
at Server.setupListenHandle [as _listen2] (node:net:1372:16)
at listenInCluster (node:net:1420:12)
at Server.listen (node:net:1508:7)
at Function.listen (C:\Teun\NeoSecurity\node_modules\express\lib\application.js:618:24)
at module.exports (C:\Teun\NeoSecurity\dashboard\dashboard.js:5243:9)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1399:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '::',
port: 5003
}
C:\Teun\NeoSecurity\node_modules\discord.js\src\sharding\Shard.js:158
reject(new Error('SHARDING_READY_DIED', this.id));
^
Error [SHARDING_READY_DIED]: Shard 1's process exited before its Client became ready.
at Shard.onDeath (C:\Teun\NeoSecurity\node_modules\discord.js\src\sharding\Shard.js:158:16)
at Object.onceWrapper (node:events:642:26)
at Shard.emit (node:events:527:28)
at Shard._handleExit (C:\Teun\NeoSecurity\node_modules\discord.js\src\sharding\Shard.js:384:10)
at ChildProcess.emit (node:events:527:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
Emitted 'error' event on Shard instance at:
at C:\Teun\NeoSecurity\node_modules\discord.js\src\sharding\Shard.js:392:49
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'SHARDING_READY_DIED'
}
I dont know how i can fix this i not that advanced
My dashboard is also in js en ejs.
I am having a issue using typeORM to a CRUD application. I get this error when i try to connect the server to the database (MySQL). The credencials are correct, but I still have error. I am using ormconfig.json
node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'#'localhost' (using password: YES)
at Handshake.Sequence._packetToError (/home/ivan/Programming/TypeORM_CRUD/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
at Handshake.ErrorPacket (/home/ivan/Programming/TypeORM_CRUD/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)
at Protocol._parsePacket (/home/ivan/Programming/TypeORM_CRUD/node_modules/mysql/lib/protocol/Protocol.js:291:23)
at Parser._parsePacket (/home/ivan/Programming/TypeORM_CRUD/node_modules/mysql/lib/protocol/Parser.js:433:10)
at Parser.write (/home/ivan/Programming/TypeORM_CRUD/node_modules/mysql/lib/protocol/Parser.js:43:10)
at Protocol.write (/home/ivan/Programming/TypeORM_CRUD/node_modules/mysql/lib/protocol/Protocol.js:38:16)
at Socket.<anonymous> (/home/ivan/Programming/TypeORM_CRUD/node_modules/mysql/lib/Connection.js:88:28)
at Socket.<anonymous> (/home/ivan/Programming/TypeORM_CRUD/node_modules/mysql/lib/Connection.js:526:10)
at Socket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12)
--------------------
at Protocol._enqueue (/home/ivan/Programming/TypeORM_CRUD/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/home/ivan/Programming/TypeORM_CRUD/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at PoolConnection.connect (/home/ivan/Programming/TypeORM_CRUD/node_modules/mysql/lib/Connection.js:116:18)
at Pool.getConnection (/home/ivan/Programming/TypeORM_CRUD/node_modules/mysql/lib/Pool.js:48:16)
at /home/ivan/Programming/TypeORM_CRUD/node_modules/typeorm/driver/mysql/MysqlDriver.js:863:18
at new Promise (<anonymous>)
at MysqlDriver.createPool (/home/ivan/Programming/TypeORM_CRUD/node_modules/typeorm/driver/mysql/MysqlDriver.js:860:16)
at MysqlDriver.<anonymous> (/home/ivan/Programming/TypeORM_CRUD/node_modules/typeorm/driver/mysql/MysqlDriver.js:288:51)
at step (/home/ivan/Programming/TypeORM_CRUD/node_modules/tslib/tslib.js:143:27)
at Object.next (/home/ivan/Programming/TypeORM_CRUD/node_modules/tslib/tslib.js:124:57) {
code: 'ER_ACCESS_DENIED_ERROR',
errno: 1045,
sqlMessage: "Access denied for user 'root'#'localhost' (using password: YES)",
sqlState: '28000',
fatal: true
}
The ormconfig.json file are:
{
"type": "mysql",
"host": "localhost",
"username": "root",
"password": "password",
"database": "database_app",
"entities": ["dist/entity/**/*.js"],
"synchronize": true
}
My post request to create new item, turns me with new item created. It is working well in localhost.
But when I deploy my app on heroku and then post request Status Code: 503 Service Unavailable , but empty res.body. Here also my server.js file
server.js
const express = require("express");
const mongoose = require("mongoose");
const cors = require("cors");
const app = express();
const items = require("./routes/api/items");
const users = require("./routes/api/user");
const auth = require("./routes/api/auth");
app.use(express.json());
require("dotenv").config();
mongoose.connect(process.env.MONGO_DB).then(console.log("connected"));
app.use(cors());
app.use("/api/items", items);
app.use("/api/users", users);
app.use("/api/auth", auth);
app.use(express.static("client/build"));
app.get("*", (req, res) => {
res.sendFile(path.resolve(__dirname, "client", "build", "index.html"));
});
const listener = app.listen(process.env.PORT || 5000, () => {
console.log("Your app is listening on port " + listener.address().port);
});
item.js
router.post("/createTeam", auth, (req, res) => {
const newItem = new Item({
name: req.body.name,
});
newItem.save(function (err, result) {
if (err) {
console.log(err);
} else {
res.json(result);
}
});
});
itemActions.js
export const addItems = (input) => (dispatch, getState) => {
axios
.post("/api/items/createTeam", input, tokenConfig(getState))
.then((res) =>
dispatch({
type: ADD_ITEM,
payload: res.data,
})
)
.catch((err) =>
dispatch(
returnErrors(err.response.data, err.response.status, "GET_ERRORS")
)
);
};
Also my heroku logs are here when I create new Team
2021-12-04T09:51:55.743015+00:00 app[web.1]: MongoWriteConcernError: No write concern mode named 'majority\"' found in replica set configuration
2021-12-04T09:51:55.743023+00:00 app[web.1]: at MessageStream.messageHandler (/app/node_modules/mongodb/lib/cmap/connection.js:463:30)
2021-12-04T09:51:55.743024+00:00 app[web.1]: at MessageStream.emit (events.js:400:28)
2021-12-04T09:51:55.743024+00:00 app[web.1]: at processIncomingData (/app/node_modules/mongodb/lib/cmap/message_stream.js:108:16)
2021-12-04T09:51:55.743024+00:00 app[web.1]: at MessageStream._write (/app/node_modules/mongodb/lib/cmap/message_stream.js:28:9)
2021-12-04T09:51:55.743025+00:00 app[web.1]: at writeOrBuffer (internal/streams/writable.js:358:12)
2021-12-04T09:51:55.743026+00:00 app[web.1]: at MessageStream.Writable.write (internal/streams/writable.js:303:10)
2021-12-04T09:51:55.743026+00:00 app[web.1]: at TLSSocket.ondata (internal/streams/readable.js:731:22)
2021-12-04T09:51:55.743026+00:00 app[web.1]: at TLSSocket.emit (events.js:400:28)
2021-12-04T09:51:55.743027+00:00 app[web.1]: at addChunk (internal/streams/readable.js:293:12)
2021-12-04T09:51:55.743027+00:00 app[web.1]: at readableAddChunk (internal/streams/readable.js:267:9) {
2021-12-04T09:51:55.743028+00:00 app[web.1]: code: 79,
2021-12-04T09:51:55.743030+00:00 app[web.1]: codeName: 'UnknownReplWriteConcern',
2021-12-04T09:51:55.743030+00:00 app[web.1]: errInfo: {
2021-12-04T09:51:55.743031+00:00 app[web.1]: writeConcern: { w: 'majority"', wtimeout: 0, provenance: 'clientSupplied' }
2021-12-04T09:51:55.743031+00:00 app[web.1]: },
2021-12-04T09:51:55.743032+00:00 app[web.1]: result: {
2021-12-04T09:51:55.743032+00:00 app[web.1]: n: 1,
2021-12-04T09:51:55.743032+00:00 app[web.1]: opTime: { ts: new Timestamp({ t: 1638611515, i: 13 }), t: 104 },
2021-12-04T09:51:55.743033+00:00 app[web.1]: electionId: new ObjectId("7fffffff0000000000000068"),
2021-12-04T09:51:55.743033+00:00 app[web.1]: ok: 1,
2021-12-04T09:51:55.743034+00:00 app[web.1]: writeConcernError: {
2021-12-04T09:51:55.743034+00:00 app[web.1]: code: 79,
2021-12-04T09:51:55.743034+00:00 app[web.1]: codeName: 'UnknownReplWriteConcern',
2021-12-04T09:51:55.743035+00:00 app[web.1]: errmsg: `No write concern mode named 'majority\\"' found in replica set configuration`,
2021-12-04T09:51:55.743035+00:00 app[web.1]: errInfo: [Object]
2021-12-04T09:51:55.743036+00:00 app[web.1]: },
2021-12-04T09:51:55.743036+00:00 app[web.1]: '$clusterTime': {
2021-12-04T09:51:55.743036+00:00 app[web.1]: clusterTime: new Timestamp({ t: 1638611515, i: 13 }),
2021-12-04T09:51:55.743036+00:00 app[web.1]: signature: [Object]
2021-12-04T09:51:55.743037+00:00 app[web.1]: },
2021-12-04T09:51:55.743037+00:00 app[web.1]: operationTime: new Timestamp({ t: 1638611515, i: 13 })
2021-12-04T09:51:55.743037+00:00 app[web.1]: }
2021-12-04T09:51:55.743037+00:00 app[web.1]: }
SOLUTION
I removed '' or "" from MONGO_DB which is on heroku config vars, and solved
so I'm trying to only run a PostgreSQL insert in a Node.js file if there isn't a row that exists in the table that contains a specific value...
db.query(`INSERT INTO table (col1, col2, col3, col4, col5) VALUES($1, $2, $3, $4, $5)`, ["default", value2, value3, value4, value5], (err, res) => {
if (err) {
console.error(err);
return;
}
});
Essentially, I'm trying to only insert into the table if there is NOT any row in the table with value2 as the value of its col2. Is this possible?
UPDATE:
The error when I'm using ON CONFLICT looks like:
2021-05-09T20:06:37.356493+00:00 app[web.1]: error: there is no unique or exclusion constraint matching the ON CONFLICT specification
2021-05-09T20:06:37.356494+00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:287:98)
2021-05-09T20:06:37.356494+00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2021-05-09T20:06:37.356495+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2021-05-09T20:06:37.356496+00:00 app[web.1]: at TLSSocket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:11:42)
2021-05-09T20:06:37.356497+00:00 app[web.1]: at TLSSocket.emit (events.js:315:20)
2021-05-09T20:06:37.356498+00:00 app[web.1]: at addChunk (internal/streams/readable.js:309:12)
2021-05-09T20:06:37.356498+00:00 app[web.1]: at readableAddChunk (internal/streams/readable.js:284:9)
2021-05-09T20:06:37.356498+00:00 app[web.1]: at TLSSocket.Readable.push (internal/streams/readable.js:223:10)
2021-05-09T20:06:37.356499+00:00 app[web.1]: at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23) {
2021-05-09T20:06:37.356499+00:00 app[web.1]: length: 148,
2021-05-09T20:06:37.356500+00:00 app[web.1]: severity: 'ERROR',
2021-05-09T20:06:37.356500+00:00 app[web.1]: code: '42P10',
2021-05-09T20:06:37.356500+00:00 app[web.1]: detail: undefined,
2021-05-09T20:06:37.356501+00:00 app[web.1]: hint: undefined,
2021-05-09T20:06:37.356501+00:00 app[web.1]: position: undefined,
2021-05-09T20:06:37.356501+00:00 app[web.1]: internalPosition: undefined,
2021-05-09T20:06:37.356501+00:00 app[web.1]: internalQuery: undefined,
2021-05-09T20:06:37.356502+00:00 app[web.1]: where: undefined,
2021-05-09T20:06:37.356502+00:00 app[web.1]: schema: undefined,
2021-05-09T20:06:37.356502+00:00 app[web.1]: table: undefined,
2021-05-09T20:06:37.356503+00:00 app[web.1]: column: undefined,
2021-05-09T20:06:37.356503+00:00 app[web.1]: dataType: undefined,
2021-05-09T20:06:37.356503+00:00 app[web.1]: constraint: undefined,
2021-05-09T20:06:37.356503+00:00 app[web.1]: file: 'plancat.c',
2021-05-09T20:06:37.356503+00:00 app[web.1]: line: '835',
2021-05-09T20:06:37.356504+00:00 app[web.1]: routine: 'infer_arbiter_indexes'
2021-05-09T20:06:37.356504+00:00 app[web.1]:
}
I am trying to input some data into a mysql database, but I can't connect to it.
My code:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword"
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
});
I have also installed mysql into my system by using npm install mysql in cmd. Whenever I try to execute the above code, I get this error:
C:\Users\Abhishek\Desktop\Data scraping\scraping.js:60
if (err) throw err;
^
Error: connect ECONNREFUSED 127.0.0.1:3306
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1129:16)
--------------------
at Protocol._enqueue (C:\Users\Abhishek\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Protocol.handshake (C:\Users\Abhishek\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at Connection.connect (C:\Users\Abhishek\node_modules\mysql\lib\Connection.js:116:18)
at Object.<anonymous> (C:\Users\Abhishek\Desktop\Data scraping\scraping.js:59:5)
at Module._compile (node:internal/modules/cjs/loader:1083:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
at Module.load (node:internal/modules/cjs/loader:948:32)
at Function.Module._load (node:internal/modules/cjs/loader:789:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12)
at node:internal/main/run_main_module:17:47 {
errno: -4078,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 3306,
fatal: true
}
How do I fix this?