Is there a bug that reveals contents in the `.env`...
# random
c
Is there a bug that reveals contents in the
.env
file on github - I saved my db URL_STRINGS in my
.env
, committed and pushed my changes to git. However, got a message from git that the info in my
.env
file is exposed (see image). I have since destroyed the databases in question, but wondering if this is a bug cos its not supposed to act this way
m
c
@Michael Marino Thanks for that, it was able to resolve the issue based on your input. Since I have you online, can I bother you again - I continue to have this error on deploying the app to Vercel:
Copy code
./pages/api/categories/subcategories.js
8:24  Error: Parsing error: /vercel/path0/pages/api/categories/subcategories.js: Unexpected reserved word 'await'. (8:24)
   6 |
   7 | const getSubCategories = async('/', (req, res) => {
>  8 |   const subCategories = await prisma.subCategory.findMany();
     |                         ^
   9 |   res.json(subCategories);
  10 | });
  11 | // Get one subCategory
This is my code:
Copy code
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

// Get all subCategories

const getSubCategories = async('/', (req, res) => {
  const subCategories = await prisma.subCategory.findMany();
  res.json(subCategories);
});
// Get one subCategory
const getSubCategory = async('/:id', (req, res) => {
  const { id } = req.params;
  const subCategory = await prisma.subCategory.findOne({ where: { id } });
  res.json(subCategory);
});
I was thinking I can
await
inside of an
async
function - no?
m
looks to me like that is being thrown because the callback inside your async function is not marked as async itself
Copy code
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

// Get all subCategories

const getSubCategories = async('/', async (req, res) => {
  const subCategories = await prisma.subCategory.findMany();
  res.json(subCategories);
});
// Get one subCategory
const getSubCategory = async('/:id', async (req, res) => {
  const { id } = req.params;
  const subCategory = await prisma.subCategory.findOne({ where: { id } });
  res.json(subCategory);
});
might not need the outer async
In order to use
await
, the function directly enclosing it needs to be async.
https://stackoverflow.com/questions/42299594/await-is-a-reserved-word-error-inside-async-function