The CLI feature is not compatible with NextJS Drizzle-Kit

I'm currently utilizing the drizzle auth template and attempting to customize it for Role Based Authentication. I've made adjustments in the db.ts file to incorporate roles.

import { drizzle } from 'drizzle-orm/postgres-js';
import { pgTable, serial, varchar } from 'drizzle-orm/pg-core';
import { eq } from 'drizzle-orm';
import postgres from 'postgres';
import { genSaltSync, hashSync } from 'bcrypt-ts';

// Here is some sample code with modifications related to roles
// Code snippet goes here...

However, when trying to update the database for the new column, I encountered an issue where drizzle does not function properly, as I am unable to migrate using CLI or open the studio.

(base) PS C:\Users\user\Documents\Projects\TemplatingDocuments\> npx drizzle-kit migrate
>> npx drizzle-kit push
No config path provided, using default 'drizzle.config.ts'
Reading config file 'C:\Users\user\Documents\Projects\TemplatingDocuments\app\drizzle.config.ts'
Using 'pg' driver for database querying

// Error message and stack trace details go here...

Below is a glimpse of my package.json:

{
  // Package JSON content goes here...
}

This is the content of my tsconfig.json:

{
  // TSConfig content goes here...
}

And here's the content of my drizzle.config.ts:

import 'dotenv/config';
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
  out: './drizzle',
  schema: './app/db.ts',
  dialect: 'postgresql',
  dbCredentials: {
    url: process.env.POSTGRES_URL!,
  },
});

I have attempted updating packages and specifying to use modules in package.json, but this action affects the functionality of nextJS.

Answer №1

I recommend utilizing the 18+ node version for optimal performance.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Attempting to incorporate a variable into the URL while making an Ajax POST request using jQuery

Currently, I am attempting to create a post using jQuery.ajax instead of an html form. Below is the code I am using: $.ajax({ type: 'POST', // GET is also an option if preferred url: '/groups/dissolve/$org_ID', data: data, success: fu ...

A guide on utilizing uglifyjs/uglifyjs2 for parsing, traversing, and evaluating JavaScript expressions

Looking for ways to parse JavaScript expressions using uglifyjs? Although it's a fantastic library, the lack of documentation can make it challenging to grasp! These resources have provided some assistance: https://groups.google.com/forum/?fromgrou ...

Change (EU Time) date format of dd/mm/yyyy hh:mm:ss to a timestamp

Is there a way to convert time into a timestamp? I attempted to use .getTime(), but it seems to be switching the day and month. const date = new Date('01-02-2003 01:02:03'); console.log(date.getTime()); It appears to be converting to the US Tim ...

Tips for bringing in pictures from JSON data into a create-react-app

I am working with JSON data that contains the image path located in my public folder (/public/images). Here is an example: const data = [ { "key": 1, "name": "Goal Squad", "techs": ["React & Redux", "Express", "MySQL"], "description": ...

Encountering a TypeError: relativeURL.replace is not a valid function in Next.js

Why am I encountering this error in my Next.js application? TypeError: relativeURL.replace is not a function. (In 'relativeURL.replace(/^/+/, '')', 'relativeURL.replace' is undefined) Request.js file const API_KEY = process ...

Is there a way to trigger javascript on Amazon once the "Next Page" button is clicked?

My Greasemonkey script is designed to run on Amazon's search results page. However, I've noticed that when the "Next Page" button is clicked and new results are dynamically loaded, my script only executes once after the initial page load. Here&a ...

Updating the row by substituting the content of two columns with the data retrieved from the action class

In my JSP page, there is a table with a refresh button on each row. Upon clicking the refresh button, a JavaScript/AJAX call is made to an action class to retrieve the values of status and number of records for that row, which are then displayed in the cor ...

How to retrieve the outcome of a stored procedure using node.js

Is it possible to retrieve multiple select results from distinct tables (many rows) in just one stored procedure in mysql and then access those results in nodejs? In .NET with SQL Server, we can use "sqlnextresult" for this purpose. VIEW IMAGE FROM STORE ...

Creating images with LibCanvas

Currently, I am utilizing LibCanvas for canvas drawing on my HTML page. However, I am facing difficulty in drawing an image. Can someone provide assistance with this? UPDATE: The code snippet I am using is showing the image being drawn but then it disappe ...

Optimal Method for Organizing Items in Express.js Using Mongodb

Can you share your insights on the best practices for sorting objects in expressjs + mongodb(mongoose) web applications? Imagine we have a Product model with four attributes: var ProductSchema = new mongoose.Schema({ name: String, // "Summer T-sh ...

How to verify the existence of a YouTube video ID using JavaScript

In this code snippet, I am using the video ID 'TOwd30wXc-0' from YouTube: $.ajax({ url: "http://gdata.youtube.com/feeds/api/videos/"+realurl+"?v=2&alt=json-in-script", dataType: "jsonp", contentType: "application/json ...

The function to navigate, 'navTo', is not defined and so it cannot be read

I am trying to create a navigation button in my SAPUI5 application deployed on Fiori _onPageNavButtonPress: function () { var oHistory = History.getInstance(); var sPreviousHash = oHistory.getPreviousHash(); if (sPreviousHash !== ...

Dynamic properties in JQuery

Here is the HTML DOM element I have... <input type="text" style="width: 200px;" id="input1"/> I want to make sure it stores date values. How can I specify that in the DOM element? Please provide your suggestions. Thanks! ...

What is the best way to display a div after a form submission?

I recently added a contact form to my website and successfully set it up so that when the user clicks the contact button, the form pops out. However, instead of redirecting the user to a separate result page after submitting the form, I want a result div ...

Arrange the array of days and months in JavaScript

Attempting to rearrange a date Array from newest to oldest has proven challenging as the list.sort function only rearranges based on the initial number. The Array in question is as follows: var MyArray = ["13 Jun", "09 Jun", "25 Aug", "30 Jun", "13 Aug"]; ...

Enhance Select Dropdown in AngularJS with Grouping and Default Selection

I am facing an issue with a form that includes a SELECT element. I have successfully loaded the possible values in my controller from a function that retrieves data from a database and groups the options by a group name. Although the list of options is lo ...

How can you make the table rows in jQuery scroll automatically while keeping the table header fixed in

Many solutions exist for making the header fixed and the table scrollable using code samples or plugins. However, my specific goal is to have the table data rows scroll automatically once they are loaded while keeping the header fixed in place. Is there a ...

Is it possible for me to bring in/need the Kik.js document instead of using the Kik Card?

Currently working on a mobile web app designed for Kik. Their documentation advises including the Kik.js file directly in your HTML like this: <!-- simply include this script in your webpage --> <script src="http://cdn.kik.com/kik/2.3.6/kik.js"&g ...

The Angular Firebase query is being run repeatedly

I'm currently facing an issue in my project where Firebase queries are being executed multiple times. This problem wasn't present during development and no changes have been made to the Firebase dependencies. Below is a snippet of code that used ...

An effective way to prevent right-clicking on iframes across all websites

I am facing an issue with disabling right click for the iframe. I've successfully disabled it for the default URL of the IFrame, but when displaying any other webpage, the right click remains usable. Below are the sample codes I have used: document.o ...