Reputation: 25
I have a small issue with the OVH web pass. I have a folder structure for my project as follows:
site folder: Contains 9 HTML files. assets folder: Contains subfolders for img, js, css, scss, fonts. server folder: Contains my package.json and a server.js file which I start with Node.js. .platform folder: Contains my platform.app.yaml file with the following configuration:`
name: 'app'
type: 'nodejs:16'
disk: 1024
web:
commands:
start: 'node server/server.js'
Here is my server.js:
import express from 'express';
import fetch from 'node-fetch';
import cors from 'cors';
import dotenv from 'dotenv';
import nodemailer from 'nodemailer';
import bodyParser from 'body-parser';
// Load environment variables from a .env file
dotenv.config();
const app = express();
app.use(bodyParser.json());
app.use(express.static(__dirname + '/../')); // Serves all HTML and assets
app.use('/assets', express.static(__dirname + '/../assets'));
app.use(cors());
// Set up the transporter for Nodemailer with Hostinger
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST || 'smtp.hostinger.com',
port: parseInt(process.env.SMTP_PORT) || 465,
secure: parseInt(process.env.SMTP_PORT) === 465,
auth: {
user: process.env.EMAIL_USER,
pass: process.env.EMAIL_PASS,
},
});
app.get('/', (req, res) => {
const authUrl = `https://api.instagram.com/oauth/authorize?client_id=${clientId}&redirect_uri=${redirectUri}&scope=user_profile,user_media&response_type=code`;
res.send(`<a href="${authUrl}">Connect to Instagram</a>`);
});
// Other routes omitted for brevity...
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(`Server started on port ${port}`);
});
The Problem is that I'm trying to push this project to the OVH webPass and deploy it, but I keep encountering a 512 error. I suspect there is an issue with the configuration of my platform.app.yaml file or my server.js file.
Could you help me identify the issue and suggest the correct way to structure or configure this to avoid the 512 error? Thank you!
Upvotes: 0
Views: 32