Unable to access supabase database

I have a Next.js app where I use Supabase’s createClient to connect to my database. The connection setup works fine, and the client initializes correctly.

However, when I try to query a table using .from(‘TableName’).select(‘*’), the request fails with a TypeError: fetch failed error. The error response is given at the end

The strange thing is that this code was working perfectly until today, and no changes were made to the code or environment variables.

This is the part of the Code which has the errors:

  console.log("DEBUG: SUPABASE_URL from process.env:", process.env.SUPABASE_URL!);
  console.log("DEBUG: SUPABASE_ANON_KEY from process.env:",process.env.SUPABASE_ANON_KEY!);

  const supabase = createClient(
    process.env.SUPABASE_URL!,
    process.env.SUPABASE_ANON_KEY!,
    { db: { schema: 'data' } }
  );
  console.log(supabase);
  const { data: drivers, error: driverError } = await supabase.from("Driver Info").select('*');
  console.log(driverError)

The Error:

{
    "message": "TypeError: fetch failed",
    "details": "TypeError: fetch failedn    at node:internal/deps/undici/undici:13178:13n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)n    at async InstrumentsPage (C:\Work\Programming\webdev\fRank\foneranked\.next\server\chunks\ssr\[root-of-the-server]__b68c1b2a._.js:82:51)",
    "hint": "",
    "code": ""
}

Is it possible to create one ClipboardItem with both MIME types?

I am trying to copy the URL of my page and embed it to HTML text, which wherever this mime is supported it shows the HTML text and we can open the URL by clicking the text (which I’ve already made possible).

The issue is with unsupported fields, for example google search, simple editors etc.
I have tried adding another mime type (text/plain) in addition to text/html so it saves both types and pastes the HTML text whenever it is supported and only the URL wherever it is not supported (of course this is the desired state).
But it still does not work.

The js file looks something like this :”

window.copyLinkWithText = (url, visibleText) => {
try {

    const htmlSnippet = `<a href="${url}">${visibleText}</a>`;
    const plainTextSnippet = url; // Just the URL in plain text

    const blobHtml = new Blob([htmlSnippet], { type: 'text/html' });
    const blobText = new Blob([plainTextSnippet], { type: 'text/plain' });

    const clipboardItemInput = new ClipboardItem({
        'text/html': blobHtml,
        'text/plain': blobText
    });

    navigator.clipboard.write([clipboardItemInput])
        .then(() => console.log("Copied both HTML and plain text to clipboard"))
        .catch(err => console.error("Error copying to clipboard:", err));
}
catch (ex) {
    console.error("Exception in copyLinkWithText:", ex);
}

};

Anyone knows what the problem is? And if it’s possible or not?

A better way to compensate for JavaScript client time-zone offset and locale, for ASP.NET Web API

Recently our QA discovered a bug where the date captured in a Vue.js three-field DoB (Date of Birth) editor control (Day, Month, Year), started to arrive at the ASP.Net Web API with a value as the day before what is entered, and also with a time of 2300 hours.

This appeared to happen after we started to store dates as as JavaScript Date object in the DoB editor Vue.js control instead of the date as a JS string, but only came to light recently as we (in the UK) moved to Summer daylight saving hours (BST) from Winter GMT. The DoB editor takes the values in its fields and provides the value back to the parent Vue, also as a JS Date.

Using various Stack Overflow solutions, I basically arrived at the following solution, which does work and allows the user entered date to arrive at the Web API with the correct value.

The web API controller endpoint declaration looks like this:

[HttpPost("authenticate")]
public async Task<IActionResult> Authenticate(PatientAuthenticationRequestDTO dto)
{
...

The DTO looks like this:

public class PatientAuthenticationRequestDTO
{
    [Required]
    [MaxLength(10)]
    public string PatientNumber { get; set; }

    [Required]
    public DateTime DateOfBirth { get; set; }
}

The value in question is stored in the DateOfBirth property

The date value is held in the following property of a structure: this.form.dateOfBirth

// Convert the date of birth to ISO for the API call
const dateOfBirthWithClientOffset = this.form.dateOfBirth;
const clientOffsetOffsetModifier = -dateOfBirthWithClientOffset.getTimezoneOffset();
const ticksMultiplier = 1000;
const secondsMultiplier = 60;
const dateOfBirthWithClientOffsetInTicks = dateOfBirthWithClientOffset.getTime() + clientOffsetOffsetModifier * ticksMultiplier * secondsMultiplier;
const dateOfBirthWithClientOffsetInUTC = new Date(dateOfBirthWithClientOffsetInTicks);
const dateformattedForDotNetSerialisation = dateOfBirthWithClientOffsetInUTC.toISOString();

// Call the API to authenticate the patient
this.$http.post(this.$endpoints.api.patient.authenticate, { patientNumber: this.form.patientNumber, dateOfBirth: dateformattedForDotNetSerialisation })
                    .then((response) => {
    ...

This solution, although working, feels very heavy handed and just plain wrong. Surely there is a more succinct way to send a JavaScript data to an ASP.Net Web API, and take into consideration locale and daylight saving?

Fatal error: Uncaught ValueError: Path cannot be empty in PHP

I created a web application using PHP. In here I got an error while I am uploading images. I got this error on only some devices (mobile and pc). Please give me instructions to fix this.

Fatal error: Uncaught ValueError: Path cannot be empty in C:wamp64wwwBungalowSignupbackend.php on line 39
(!)ValueError: Path cannot be empty in C;lwamp64wwwBungalowSignupbackend.php on line 39

Line 39 is:

$check = getimagesize($_FILES["Picture"]["tmp_name"]);

Code below:

<?php
      include("Mysqlconnection.php");
      require 'PHPMailer/src/PHPMailer.php'; 
      require 'PHPMailer/src/SMTP.php';
      require 'PHPMailer/src/Exception.php';

      use PHPMailerPHPMailerPHPMailer;

    if (isset($_POST['submit'])) {
    $EmployeeID = $_POST['EmployeeID'];
    $Phone = $_POST['Phone'];
    $Password = $_POST['Password'];
    $cPassword = $_POST['cPassword'];

    $sql_executives = "SELECT Email, Name FROM executives WHERE EmployeeID='$EmployeeID'"; 
    $result_executives = mysqli_query($connection, $sql_executives);
    $count_executives = mysqli_num_rows($result_executives);

    if ($count_executives > 0) { // EmployeeID exists in executives table
        $row_executives = mysqli_fetch_assoc($result_executives);
        $Email = $row_executives['Email'];
        $Name = $row_executives['Name'];

        $sql_users = "SELECT * FROM users WHERE EmployeeID='$EmployeeID'";
        $result_users = mysqli_query($connection, $sql_users);
        $count_users = mysqli_num_rows($result_users);

        if ($count_users == 0) {
            if ($Password == $cPassword) {
                // Handle file upload
                $target_dir = "uploads/"; // Ensure this directory exists
                $file_name = basename($_FILES["Picture"]["name"]); // Get the file name
                $target_file = $target_dir . $file_name; // Full path for moving the file
                $uploadOk = 1;
                $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));

                // Check if image file is an actual image or fake image
                $check = getimagesize($_FILES["Picture"]["tmp_name"]);
                if ($check !== false) {
                    // Check file size (e.g., limit to 5MB)
                    if ($_FILES["Picture"]["size"] > 5000000) {
                        echo '<script>alert("Sorry, your file is too large."); window.location.href="Signup.php";</script>';
                        $uploadOk = 0;
                    }
                } else {
                    echo '<script>alert("File is not an image."); window.location.href="Signup.php";</script>';
                    $uploadOk = 0;
                }

                // Allow certain file formats
                if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
                    echo '<script>alert("Sorry, only JPG, JPEG, PNG & GIF files are allowed."); window.location.href="Signup.php";</script>';
                    $uploadOk = 0;
                }

                // Check if $uploadOk is set to 0 by an error
                if ($uploadOk == 0) {
                    echo '<script>alert("Sorry, your file was not uploaded."); window.location.href="Signup.php";</script>';
                } else {
                    // Attempt to upload the file
                    if (move_uploaded_file($_FILES["Picture"]["tmp_name"], $target_file)) {
                        // Insert data into the users table, including only the file name
                        $sql_insert = "INSERT INTO users(EmployeeID, Name, Email, Phone, Password, Picture) VALUES('$EmployeeID', '$Name', '$Email', '$Phone', '$Password', '$file_name')";
                        $result_insert = mysqli_query($connection, $sql_insert);
                        if ($result_insert) {
                            // Send a success email to the user
                            $mail = new PHPMailer;
                            $mail->isSMTP();
                            $mail->Host = 'smtp.gmail.com';
                            $mail->SMTPAuth = true;
                            $mail->Username = '[email protected]';
                            $mail->Password = 'verw mhtt wikv itgm'; // Ensure this is secure in production
                            $mail->SMTPSecure = 'ssl';
                            $mail->Port = 465;

                            $mail->setFrom('[email protected]', 'Miriyakelle Bunglow');
                            $mail->addAddress($Email);

                            $mail->isHTML(true);
                            $mail->Subject = 'Bungalow Booking Account Created';
                            $mail->Body = "<h1>Account Created Successfully</h1>
                                           <p>Dear $Name,</p>
                                           <p>You have successfully created a Bungalow Booking account.</p>
                                           <p>Thank you for joining us!</p>";

                            if ($mail->send()) {
                                echo '<script>
                                        alert("Signup successful! Confirmation email sent.");
                                        window.location.href="Login.php";
                                      </script>';
                            } else {
                                echo '<script>
                                        alert("Signup successful, but failed to send confirmation email.");
                                        window.location.href="Login.php";
                                      </script>';
                            }
                        } else {
                            echo "Error: " . mysqli_error($connection);
                        }
                    } else {
                        echo '<script>alert("Sorry, there was an error uploading your file."); window.location.href="Signup.php";</script>';
                    }
                }
            } else {
                echo '<script>
                        window.location.href="Signup.php";
                        alert("Passwords do not match!");
                      </script>';
            }
        } else {
            echo '<script>
                    window.location.href="Signup.php";
                    alert("EmployeeID already exists!!");
                  </script>';
        }
    } else {
        echo '<script>
                window.location.href="Signup.php";
                alert("EmployeeID does not exist! Contact administrator or HR.");
              </script>';
    }
}
?>

I want help to fix this error.

I have this problem of undefined variable from the remote server, but this error does not occur on the local server. Can anyone help to solve it? [closed]

This is the error message:

ErrorException
Undefined variable $evento (View: /path/public_html/resources/views/admin/prelectores/index.blade.php)

This is function

class PreletorController extends Controller
{
     /**
     * Display a listing of the resource.
     *
     * @return IlluminateHttpResponse
     */
    public function index($id)
    {
        
        $evento = Evento::find($id);
        $participantes = $evento->participantes()->where('participante_como','Prelector')->get();
        //dd($participantes[0]->preletor);
        return view('admin.prelectores.index', compact('participantes', 'evento'));
    }



Route::get('{id}/preletores/index', [PreletorController::class, 'index'])->name('prelector.index');

How to support unicode characters in a my mysqli based server [duplicate]

I have been tasked to add full unicode support inside our software.
We use Curl to send request to the server, and I am very new to php.
We want to support this type of email:
沙发模型@gmail.com
I tried to create accounts with that name and it fails for both gmail and outlook. But before dropping the feature i need to be 100% sure only utf-8 emails are allowed worldwide. So i want to support wide strings not just utf-8.

Our test database table look like this:
Database table

Here how an user is registered:

$result = mysqli_query($this->m_conn, "INSERT INTO ".self::TABLE_NAME."(EMAIL, LICENSE_KEYS, COMPUTER_CODES, IPS)  VALUES ('$email', '$license', 'null', 'null')");
if (!$result)
    Logger::ExitWithMessage($email, "DB: unable to insert user. SQL error:". mysqli_error($this->m_conn));

If i try to add a chinese user to our test table:

$robertoEmail = "roberto_沙发模型@hotmail.com";
$robertoLicense = "371C-5BE3-6EF4-9DBC-7F65";
        
$result = mysqli_query($this->m_conn, "INSERT INTO ".self::TABLE_NAME."(EMAIL, LICENSE_KEYS, COMPUTER_CODES, IPS)  VALUES ('$robertoEmail', '$robertoLicense', 'null', 'null')");
if (!$result)
    Logger::ExitWithMessage($robertoEmail, "DB: unable to insert user. SQL error:". mysqli_error($this->m_conn));

When I check the table, I get this “roberto_æ²™å‘æ¨¡åž‹@hotmail.com” as the email:
wrong table email

The email stored in the database is broken. But something strange i query the table with the roberto user(roberto_沙发模型@hotmail.com) it works:

$robertoEmail = "roberto_沙发模型@hotmail.com";

$query = mysqli_query($this->m_conn, "SELECT * FROM `". self::TABLE_NAME. "` WHERE EMAIL='$robertoEmail'");
if (!$query)
    Logger::ExitWithMessage($email, "DB: Can't select. SQL error:". mysqli_error($this->m_conn));

$user = mysqli_fetch_array($query);
mysqli_free_result($query);
    
if (!$user)
{
    error_log("GetUser failed");
    return;
}

// Everything worked!

Even more strange if i try to manually add roberto to the table:

    INSERT INTO `LICENSES_TABLE`(`EMAIL`, `LICENSE_KEYS`, `COMPUTER_CODES`, `IPS`) VALUES ('roberto_沙发模型@hotmail.com', '371C-5BE3-6EF4-9DBC-7F65', 'null', 'null')

I get this:
I get this

The email is reported as “[email protected]”.

How to properly support unicode emails in a mysqli based server?
Thanks!

While it is not relevant. Here how our C++ application send request to the server

RequestResult NetWork::sendRequest(const bool isPost, const std::string& relativeUri, const std::string& body) const
{
    CURL* handle = curl_easy_init();
    if (!handle)
        return RequestResult();

    /* First set the URL that is about to receive our POST. This URL can
     * just as well be a https:// URL if that is what should receive the
     * data.
     */
    curl_easy_setopt(handle, CURLOPT_URL, ("https://www.mywebsite.com/" + relativeUri).c_str());

    // Skip SSL verification.
    // Not required when server use a certificate signed by a trusted CA.
    // @See: https://stackoverflow.com/questions/56739554/is-https-without-ssl-verification-secure-for-local-application
    {
        /*
         * If you want to connect to a site who isn't using a certificate that is
         * signed by one of the certs in the CA bundle you have, you can skip the
         * verification of the server's certificate. This makes the connection
         * A LOT LESS SECURE.
         *
         * If you have a CA cert for the server stored someplace else than in the
         * default bundle, then the CURLOPT_CAPATH option might come handy for
         * you.
         */
        curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L);

        /*
         * If the site you're connecting to uses a different host name that what
         * they have mentioned in their server certificate's commonName (or
         * subjectAltName) fields, libcurl will refuse to connect. You can skip
         * this check, but this will make the connection less secure.
         */
        curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L);
    }

    // Specify the request type
    curl_easy_setopt(handle, CURLOPT_POST, (int)isPost);

    // Specify the body
    curl_easy_setopt(handle, CURLOPT_POSTFIELDS, body.c_str());

    // Specify the write callbaks
    RequestResult requestResult;
    curl_easy_setopt(handle, CURLOPT_WRITEDATA, &requestResult.res);
    curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, CurlWrite_CallbackFunc_StdString);

    // Perform the request
    const CURLcode res = curl_easy_perform(handle);
        
    // Check result
    if (res == CURLE_OK)
    {
        long http_code = 0;
        curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &http_code);
        requestResult.success = http_code < 400;
    }
    else
    {
        _TRACE(requestResult.res);
    }

    // Cleanup
    curl_easy_cleanup(handle);

    return requestResult;
}

As you can see in the declaration the body is a std::string not a wide string. I dont know how it magically works but if email is (roberto_沙发模型@hotmail.com) then the sendRequest body contains (roberto_æ²™å‘æ¨¡åž‹@hotmail.com). The request is sent and the server understand that the real email is (roberto_沙发模型@hotmail.com)
request is sent

Scheduler completion regular task Moodle Stuck 3.6.2

moodle version 3.6.2, php 7.2 nts, Windows
I using task scheduler for running cron daily, when i check on moodle scheduledtasks
I notice the task completion_regular_task is stuck ( when i run on web it’s say Cannot obtain task lock ).
After deep searching, I notice when cron is running specially on
it’s stop and stuck there, I left for 24 hours and still stuck there, when i check on db mdl_lock_db task completion_regular_task is stuck and when I check on process db ssms


    Execute scheduled task: Calculate regular completion data (coretaskcompletion_regular_task)
    ... started 00:15:48. Current memory use 23.2MB.
    Starting course completion batch processing...
    >> Processed 0 records.
    >> Completion cron finished.

`

SELECT
    r.session_id AS VictimSession,
    r.blocking_session_id AS BlockingSession,
    r.wait_type,
    r.wait_time,
    r.last_wait_type,
    r.status,
    r.command,
    r.wait_resource,
    st.text AS RunningSQL
FROM sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) st
WHERE r.blocking_session_id <> 0;

`

VictimSession | BlockingSession | wait_type | wait_time | last_wait_type | status | command

52 | 52 | LCK_M_IX | 10768 | LCK_M_IX | suspended | UPDATE

  1. purge cache moodle
  2. delete file on moodledata (like cache, session, lock,temp)
  3. Debug on config moodle, show all error add some code like try and catch (to check if it’s work or not, the code is showing but it’s stuck again)
  4. check on log php and log moodle (got nothing, it’s not error)
  5. add index on table (maybe the data on db is too much)
  6. check on forum moodle (find nothing)

I though it’s because I using NFS and it’s locking (race condition), but even after I put moodledata on local server it’s still got same result, I only test cron on 1 server (other is shutdown, to make sure no double run cron)
my case is exactly same like this

This never happen before and usually after purgecache everything is back to normal.
Already stuck almost 2 weeks and still no clue for fixing this problem any idea?

Error exception on codeigniter 4 about open failed to open stream

error description

This error occurred when I uploaded an image file with the rules I wrote in the model. The image is still uploaded into a path that I have specified even though this error appears. AI said this error appears because codeIgniter doesn’t find the temporary file from your image upload. This is a typical error when the file has disappeared before being handled by the server.

protected $validationRules = [
        'image' => 'uploaded[image]|max_size[image,2048]|is_image[image]|mime_in[image,image/png,image/jpeg,image/jpg]',
    ];

controller code

in my controller, the way I check the validation for the uploaded file is like in the attached image. I hope to use validation from the model instead of writing it manually in the controller but written directly in the model.

How to achieve seamless auto printing to Epson thermal receipt printers from a web app without installing a local client?

Seamless Auto Printing from Web App to Epson TM-M30III Without Native App Installation

We’ve got a browser-based application used by multiple clients, and we’re trying to get seamless auto printing working with Epson thermal receipt printers — specifically the TM-M30III model.

Right now, we’re using Epson Server Direct Printing, where each printer polls a server endpoint every 5–10 seconds. It works fine, but it requires manual setup on the client’s side.

The issue is:
Company policy doesn’t allow us to install any local helper app or native software on the client’s PC, tablet, or phone — which really limits our options.

What we’re aiming for

  • Let clients easily set up printing from our web app

  • Avoid needing to log into the physical printer’s admin panel (via IP) to set up the polling URL — ideally this step could be automated or handled remotely

  • Enable auto printing (ideally triggered by the server or browser)

  • Work over Bluetooth, WiFi, or LAN — the printers support all three

What we’ve tried or looked into

  • Server Direct Printing – works, but needs manual config in the printer’s web UI
  • Epson ePOS SDK – but browsers can’t access local devices directly
  • Wrapping the app with CapacitorJS or anything similar – ruled out due to policy
  • IP or MAC discovery for direct printing – blocked by browser sandbox/security

Question

Is there any browser-compatible approach, SDK, or Epson feature that lets us pull off seamless auto printing to TM-M30III from a web app, without installing anything or having to configure the printer manually?

I’ve searched around but most solutions assume you can

visibilitychange event not working on chromeos, when laptop is turned on from sleep mode in vuejs

when user turns on his laptop, I am trying to check user’s last activity time on mounted in vuejs3, i am using below code for it:

document.addEventListener('visibilitychange', () => {
    if (document.visibilityState === 'visible') {
        console.log('Tab is active');
        this.checkInactivity();
    } else {
        console.log('Tab is inactive');
    }
});

This code is working on Window OS, Apple OS, but It is not working on chromeOS (chromebook) when i turn on the laptop from sleep mode.

Can somebody help ?

Uncaught error: invariant expected layout router to be mounted

Whenever I create new next.Js project on VS code, and run it on server this error appears. I have checked the layout file it has <html> and <body> tags and also my versions are also up-to-date. I also check by inspecting, this is the error

Uncaught Error: invariant expected layout router to be mounted
at OuterLayoutRouter (layout-router.js:366:37)
at OuterLayoutRouter ()

Please let me know what is the origin for that error. Thank you.
All the files code are defaulted

I can’t find fault in my code for that errors. And I googled it but i can’t find any solution for this.

WhastApp Bulk Message

I want to send bulk messages in whatsapp like sending same message at same time to multiple users.So far, I have not found any free api for testing it. I would be grateful if someone were to guide me.I’m new to coding and I’m a mern stack developer.
Help !!

Passing an array of objects to a function in React/Javascript

I’m using a Line Chart Component from Cloudscape. I have a line-chart.jsx component that has the below code

export default function LineChart({chartData}} {
  return (
    <LineChart
      series={[
        {
          title: "Site 1",
          type: "line",
          data: [chartData]
          //rest of code here
    }

In another React component I’m importing LineChart – but I’m not able to get the data to show up no matter what I do.

const dummy_data = [{ x: new Date('2025-05-16'), y: 58020 },
{ x: new Date('2025-05-17'), y: 102402 },
{ x: new Date('2025-05-18'), y: 104920 }]

...rest of code
<LineChart chartData = {dummy_data} />

I have tried every iteration of using [] or {}, but I’m not able to get the data to show up no matter what I do. What am I doing wrong?