Axis labels are squished and not spaced correctly

I recetly updated highcharts / highstock java script and now I have problems with x-axis rendering. Please see the example,

https://jsfiddle.net/cx6pf0wL/2/

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>

Product version
Highcharts JS v11.4.8 (2024-08-29) ( Updated from Highcharts JS v7.1.1 )
Highstock JS v11.4.8 (2024-08-29) ( Updated from Highcharts JS v7.1.1 )

The first chart was displayed correctly with older version.
x-axis labels are not rendered correctly
x- axis labels are squished

x-axis labels are not rendered correctly

Working chart with Highstock JS v7.1.1 (2019-04-09)

Using window.open() opens in Internet Explorer

My application is very old, and part of it is an ASP.net web app. I have a link to send users to get Acrobat if they don’t already have it to view PDFs. The link calls a JS function and that calls window.open() with the URL. It tries to open in IE even though I have Chrome set as my default browser. I have also prepended the URL with “microsoft-edge:”, in which case, it opens in IE, then in Edge.

I would like to understand why IE is targeted at all, and how I can alter my call to just open up in the user’s default browser.

What is flaky in Playwright locator getters?

We are using Chai JS assertions with Playwright, e.g.

await page.locator('input.checkbox')
assert.isTrue(await page.locator('button.submit').isEnabled());

However, locator.isEnabled() documentation says, that:

If you need to assert that an element is disabled, prefer expect(locator).toBeEnabled() to avoid flakiness. …

Examining the documentation, I would say the only difference between locator.isEnabled() and expect(locator).toBeEnabled() is the default timeout only (but it can be changed).

So, what kind of “flakiness” is this warning about?

  • If our code does not use any asynchronous code (async/await or callbacks), I expect locator.isEnabled() to be reliable always.
  • If our code does some DOM changes asynchronously, I can use locator.isEnabled({timeout: ...}) and I expect the result would be non-flaky like for the expect(locator).toBeEnabled({timeout: ...}) version.

Google OAuth2 giving “Invalid grant_type” error

I’ve been wrestling with learning how to interact with google’s api, including learning to use OAuth2. I’ve gotten most of the way there – I’ve got the authorization code. Now I’m trying to trade that in for an access token but I keep getting a ‘unsupported_grant_type’ error. I’ve triple checked and I made the grant_type ‘authorization_code’ which I’m pretty sure is what it’s supposed to be.

I haven’t been able to find very many examples or answers of how to do this in html and javascript so I’ve come here for help.

Here’s my code for getting the token:

function getToken(){
   let credentials;
   var data = {'code': authCode,
               'client_id': clientid
               'client_secret': clientsecret,
               'redirect_uri': redirecturi,
               'grant_type': 'authorization_code'};
    const xhr = new XMLHttpRequest();
    xhr.open("POST", "https://oauth2.googleapis.com/token");
    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xhr.onreadystatechange = function() {
       if (this.readyState == 4 && this.status == 200){
          credentials = JSON.parse(this.response);
          gapi.client.SetToken(credentials.access_token);
       }
       else {
          document.getElementById("error").innerHTML = this.readyState + " + " + this.response;
                      
       }
    }
    xhr.send(data);
}

(authCode, clientid, clientsecret, and redirecturi are all either predefined variables or replaced for security)

This creates the output:

3 + { “error”: “unsupported_grant_type”, “error_description”: “Invalid grant_type: ” }

Can anyone give me a hint as to what I might be doing wrong? Much appreciated!

Aplikacja w React i c# [closed]

Piszę aplikację w językach programowania React i C# i nie chce mi działać. Proszę o pomoc.

Przesyłam kody z React i C#

Header.js

import React from 'react';

function Header() {
  return(
    <header>
        <h1>Sklep z owocami i warzywami</h1>
    </header>
  );
}

export default Header;

ProductList.js

import React, { useState, useEffect } from 'react';
import Product from './Product';

function ProductList() {
  const [products, setProducts] = useState([]);

  useEffect(() => {
    fetch('https://localhost:5001/api/products')
      .then(response => response.json())
      .then(data => setProducts(data));
  }, []);

  return (
    <div>
      {products.map(product => (
        <Product key={product.id} product={product} />
      ))}
    </div>
  );
}

export default ProductList;

Product.js

import React from 'react';

function Product ({product}) {
    return(
        <div className="product">
         <h2>{product.name}</h2>
         <p>{product.price} PLN</p>
        </div>
    )
}

export default Product;

App.js

import React from 'react';
import Header from './components/Header';
import ProductList from './components/ProductList';
import './App.css';

function App() {
  return (
    <div className="App">
      <Header />
      <ProductList />
    </div>
  );
}

export default App;

progream.cs C#

using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;

namespace FruitVegetableShopAPI.Controllers
{
    [ApiController]
    [Route("api/[controller]")]
    public class ProductsController : ControllerBase
    {
        [HttpGet]
        public IEnumerable<Product> Get()
        {
            return new List<Product>
            {
                new Product { Id = 1, Name = "Jabłko", Price = 2.99M },
                new Product { Id = 2, Name = "Marchewka", Price = 1.99M },
                new Product { Id = 3, Name = "Ziemniak", Price = 2.69M },
                new Product { Id = 4, Name = "Pietruszka", Price = 5.99M },
                new Product { Id = 5, Name = "Seler", Price = 4.99M },
                new Product { Id = 6, Name = "Gruszka", Price = 4.49M },
                new Product { Id = 7, Name = "Mango", Price = 5.99M },
                new Product { Id = 8, Name = "Por", Price = 5.49M },
                new Product { Id = 9, Name = "Kalafior", Price = 7.99M },
                new Product { Id = 10, Name = "Koperek", Price = 4.50M },
                new Product { Id = 11, Name = "Śliwka", Price = 7.50M },
                new Product { Id = 12, Name = "Cytryna", Price = 5.99M },
                new Product { Id = 13, Name = "Fasola", Price = 6.99M },
                new Product { Id = 14, Name = "Banan", Price = 5.40M },
                new Product { Id = 15, Name = "Pomarańcza", Price = 6.99M }
            };
        }
    }

    public class Product
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public decimal Price { get; set; }
    }
}

StartUp.cs C#

 void ConfigureServices(IServiceCollection services)
{
    services.AddCors(options =>
    {
        options.AddDefaultPolicy(
            builder =>
            {
                builder.WithOrigins("http://localhost:3000")
                       .AllowAnyHeader()
                       .AllowAnyMethod();
            });
    });
    services.AddControllers();
}

 void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
    }

    app.UseCors();

    app.UseRouting();

    app.UseAuthorization();

    app.UseEndpoints(endpoints =>
    {
        endpoints.MapControllers();
    });
}

Po napisaniu sądziłem , że będzie działać ale nie działa. Nie wiem czy czegoś nie zawarłem w kodzie. Pierwszy raz piszę w języku programowania React

chat interface auto scrolling not working

I am working on webflow, I’ve created a chat interface where each message appears with a 2-second delay, and I set the container to overflow: auto so users can scroll. Now, I want to make the chat auto-scroll to the latest message whenever a new one appears. Please use the tablet version to understand, the interface is in the 2nd section of the page

I’ve added a JavaScript code:

However, this code is not working. The chat does not scroll when new messages appear.

Here is my Read-Only link:
:point_right: [My Webflow Project]
https://preview.webflow.com/preview/mabelles-ultra-awesome-site?utm_medium=preview_link&utm_source=designer&utm_content=mabelles-ultra-awesome-site&preview=a3416b477281c47b3ec6738f543b0ebe&pageId=6702d4ad3e204f6ee8635e93&locale=en&workflow=preview

Can someone please help me troubleshoot this? Thanks

i’ve tried this code

<script>
    document.addEventListener("DOMContentLoaded", function() {
        var chatContainer = document.getElementById("chat-messages");

        if (!chatContainer) {
            console.error("L'élément #chat-messages n'existe pas !");
            return;
        }

        // Fonction pour faire défiler la boîte de messages vers le bas
        function scrollToBottom() {
            chatContainer.scrollTo({
                top: chatContainer.scrollHeight,  // Positionner le scroll à la fin du contenu
                behavior: "smooth"               // Pour un défilement fluide
            });
        }

        // Observer l'ajout de nouveaux messages
        var observer = new MutationObserver(function(mutations) {
            mutations.forEach(function(mutation) {
                mutation.addedNodes.forEach(function(node) {
                    // Vérifier que c'est un message avec un ID commençant par "message-"
                    if (node.nodeType === 1 && node.id.startsWith("message-")) {
                        console.log("Nouveau message ajouté", node);

                        // Attendre que l'animation Webflow soit terminée avant de défiler
                        setTimeout(function() {
                            console.log("Défilement vers le bas après l'animation");
                            scrollToBottom();  // Défile vers le bas après l'animation
                        }, 2000);  // 2 secondes pour attendre l'animation
                    }
                });
            });
        });

        // Observer les changements dans le conteneur des messages
        observer.observe(chatContainer, { childList: true, subtree: true });

        // Suppression du premier défilement automatique au chargement initial
        // setTimeout(scrollToBottom, 500); // Supprimer cette ligne
    });
</script>

However, this code is not working. The chat does not scroll when new messages appear.
can you please propose a code that works?

Race condition when uploading a file in chunks

File is “sliced” into multiple chunks on the browser, then post requests are fired with each chunk inside FormData, along with the index and total number of chunks.

On the server each request goes like this;

  1. temp directory is created if doesn’t already exist
  2. chunk is placed into a file in that directory; file is named using the chunk index
  3. when done, a readdir is performed on the temp directory
  4. if number of files matches the number of chunks, file assembly starts

Problem is that the condition in #4 is triggered sometimes in 2 requests, sometimes in 4 etc. It looks like a race condition to me. I tried keeping an array with list of files that are currently being assembled, then check in each request if the file is already in that array and skip if it is, but it doesn’t really help. I assumed that since Deno has the event loop single threaded it would only go into that array check condition once.

Could it have something to do with unit testing? Because this case happens with a simple unit test that generates just a few bytes of data. I couldn’t test it with proper data because the app is not finished yet.


Request handler looks like this:

  const formData = await req.formData();
  const data = formData.get("data");
  const chunkIndex = z.coerce.number().parse(formData.get("chunkIndex"));
  const numChunks = z.coerce.number().parse(formData.get("numChunks"));

  if (!data) {
    throw new HttpError(400, ["missing_file_data"]);
  }

  const tempDir = path.join(
    env.DATA_PATH,
    `incoming_${query.name}`,
  );
  await maybeMkDir(tempDir);

  const tempFilePath = path.join(tempDir, String(chunkIndex));
  const bytes = await (data as File).bytes();
  await Deno.writeFile(tempFilePath, bytes, { mode: 0o644 });

  // assemble files
  if (!pendingFiles.has(tempDir) && (await haveAllChunks(tempDir, numChunks))) {
    pendingFiles.add(tempDir);

    console.log("assembling")

    const targetDir = env.DATA_PATH;
    await maybeMkDir(targetDir);

    const absPath = path.join(targetDir, query.name);
    const fh = await Deno.create(absPath);
    let bytesWritten = 0;

    for (let i = 0; i < numChunks; i++) {
      const t = path.join(tempDir, String(i));
      const bytes = await Deno.readFile(t);
      bytesWritten += await fh.write(bytes);
    }

    fh.close();
    await Deno.remove(tempDir, { recursive: true });

    const fileInfo = await Deno.stat(absPath);
  
    pendingFiles.delete(tempDir);
    return { completed: true, bytesWritten };

  }

  return { completed: false }

Viewport “initial-scale=1” meta tag zooms in when added with javascript

I’m working in a legacy codebase where the existing web pages are not built in a mobile-responsive fashion. I am working on slowly migrating these web pages to be responsive, and I have come across a case where I need to switch to a responsive view some time after the page has already loaded.
To accomplish this, I am using JavaScript to add the viewport meta tag.

I am encountering some unusual behavior where the initial-scale property is behaving as if it were slightly zoomed in. i.e., initial-scale=1 is behaving more like intial-scale=1.2. I have reproduced this behavior on https://google.com, you can do so with the following steps:

  1. Load the site, then in dev tools enable device emulation.
  2. In the console, execute the following:
    const viewport = document.createElement("meta");
    viewport.name = "viewport";
    viewport.content = "initial-scale=1.0";
    document.head.appendChild(viewport);
    
  3. The page will be slightly zoomed in:
    List item

I’ve already tried adding width=device-width, but that didn’t change the behavior.
Any ideas on how to prevent this?

worker_threads, loading ffi-napi in a mult-threads causes “Segmentation Fault” on close thread

I’m working on an API for tax issuance and using a library in .so format. The library is available here, and you can download it here. i split task with worker_threads.js

I’m starting a new worker instance and loading the .so file using napi-ffi. The code works fine during execution, but it causes a segmentation fault when I close the worker.

Here’s some additional context:

I’m using the express library to run the API.

The environment is Ubuntu.

Has anyone encountered a similar issue or can help me debug this?

Thank you in advance!

the Code index.js;

const express = require('express');
//const cors = require('cors');
//const fs = require('fs');
const bodyParser = require('body-parser');
// require('dotenv').config()

const port = 5723;

const { Worker } = require('node:worker_threads')

// const dbConnect = require(`${__dirname}/lib/databaseConnector`);

// const db = new dbConnect();

const app = express()

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json())

const path = require("node:path")
//
// Evento NOTA FISCAL
//
app.get('/NFE', function (req, res) {
    
        var post = { body: req.body, headers: req.headers }
        try {
            const worker = new Worker(path.resolve(__dirname, 'NFE.js'), post)
            worker.on('message', (data) => res.status(200).send(data));
        } catch (error) {
           console.log(error)
        }
    
        //worker.postMessage(post);
        
    
});


app.get('/', async function (req, res) {
    var html = "<html><body><h1>Hera</h1></body></html>"
    res.send(html)
}),
1
app.listen(port, () => {
    console.log(`servidor rodando ${port}`)
});

the NFE.js code

const { parentPort, workerData } = require("node:worker_threads")

parentPort.on('message', async (req) => {

})


async function loadAcbr(){
    const ref = require("ref-napi");
    const path = require("node:path");
    const acbrLib = require('./interface_nfe.js');
    const handle = ref.alloc('pointer');

    var buflength = 256;

    const aloc_sResposta = Buffer.alloc(buflength);
    const aloc_esTamanho = ref.alloc("int");
    //Diretórios usados
    

    // var ret = acbrLib.NFE_Inicializar(handle, './NFeConfig.ini', '')
    // var pathLog = path.resolve(__dirname)
    //acbrLib.NFE_ConfigGravarValor(handle, "Principal", "LogPath", './log')
    //acbrLib.NFE_Finalizar(handle)
    parentPort.postMessage({ "MESSAGE": "fim", });

    parentPort.close();
}

loadAcbr()

the interface_nfe.js code

const path = require('path');
const ffi = require('ffi-napi');

// inicia variável de acordo com o OS
if(process.platform == 'win32'){
    var pathDllACBrLibNFe = path.join(__dirname, 'ACBrNFe64.dll')
}else if(process.platform == 'linux'){
    var pathDllACBrLibNFe = path.join(__dirname, 'libacbrnfe64.so')
}


module.exports = ffi.Library(pathDllACBrLibNFe, {

    //Métodos da Biblioteca

    // NFE_Inicializar([eArqConfig, eChaveCrypt]);
    NFE_Inicializar: ['int', ['pointer', 'string', 'string']],
    // NFE_Finalizar();
    NFE_Finalizar: ['int', ['pointer']],
    // NFE_UltimoRetorno(sMensagem, ref esTamanho);
    NFE_UltimoRetorno: ['int', ['pointer', 'string', 'string']],
    // // NFE_Nome(sNome, ref esTamanho);
    // NFE_Nome: ['int', [ 'string', 'string']],
    // // NFE_Versao(sVersao, ref esTamanho);
    // NFE_Versao: ['int', [ 'string', 'string']],

    //Métodos de Configuração

    // NFE_ConfigLer([eArqConfig]);
    NFE_ConfigLer: ['int', ['pointer', 'string']],

    // NFE_ConfigGravar([eArqConfig]);
    NFE_ConfigGravar: ['int', ['pointer', 'string']],

    // NFE_ConfigLerValor(eSessao, eChave, sValor, esTamanho);
    NFE_ConfigLerValor: ['int', ['pointer', 'string', 'string', 'string', 'string']],
    
    // NFE_ConfigGravarValor(eSessao, eChave, sValor);
    NFE_ConfigGravarValor: ['int', ['pointer', 'string', 'string', 'string']],

    // NFE_ConfigImportar([eArqConfig]);
    NFE_ConfigImportar: ['int', ['pointer', 'string']],
    // NFE_ConfigExportar(sMensagem, ref esTamanho);
    NFE_ConfigExportar: ['int', ['pointer', 'string', 'string']],

    //Métodos NFe

    // NFE_CarregarXML(eArquivoOuXML);
    NFE_CarregarXML: ['int', ['pointer', 'string']],
    // NFE_CarregarINI(eArquivoOuINI);
    NFE_CarregarINI: ['int', ['pointer', 'string']],
    // NFE_ObterXml(AIndex, sResposta, esTamanho);
    NFE_ObterXml: ['int', ['pointer', 'int', 'string', 'string']],
    // NFE_GravarXml(AIndex, [eNomeArquivo], [ePathArquivo]);
    NFE_GravarXml: ['int', ['pointer', 'int', 'string', 'string']],
    // NFE_ObterIni(AIndex, sResposta, esTamanho);
    NFE_ObterIni: ['int', ['pointer', 'int', 'string', 'string']],
    // NFE_GravarIni(AIndex, eNomeArquivo, [ePathArquivo]);
    NFE_GravarIni: ['int', ['pointer', 'int', 'string', 'string']],
    // NFE_CarregarEventoXML(eArquivoOuXML);
    NFE_CarregarEventoXML: ['int', ['pointer', 'string']],
    // NFE_CarregarEventoINI(eArquivoOuINI);
    NFE_CarregarEventoINI: ['int', ['pointer', 'string']],
    // NFE_LimparLista();
    NFE_LimparLista: ['int', ['pointer']],
    // NFE_LimparListaEventos();
    NFE_LimparListaEventos: ['int', ['pointer']],
    // NFE_Assinar();
    NFE_Assinar: ['int', ['pointer']],
    // NFE_Validar();
    NFE_Validar: ['int', ['pointer']],
    // NFE_ValidarRegrasdeNegocios(sResposta, esTamanho);
    NFE_ValidarRegrasdeNegocios: ['int', ['pointer', 'string', 'string']],
    // NFE_VerificarAssinatura(sResposta, esTamanho);
    NFE_VerificarAssinatura: ['int', ['pointer', 'string', 'string']],
    // NFE_GerarChave(ACodigoUF, ACodigoNumerico, AModelo, ASerie, ANumero, ATpEmi, AEmissao, ACNPJCPF, sResposta, esTamanho);
    NFE_GerarChave: ['int', ['pointer', 'int', 'int', 'int', 'int', 'int', 'int', 'string', 'string', 'string', 'string']],
    // NFE_ObterCertificados(sResposta, esTamanho);
    NFE_ObterCertificados: ['int', ['pointer', 'string', 'string']],
    // NFE_GetPath(ATipo, sResposta, esTamanho);
    NFE_GetPath: ['int', ['pointer', 'int', 'string', 'string']],
    // NFE_GetPathEvento(ACodEvento, sResposta, esTamanho);
    NFE_GetPathEvento: ['int', ['pointer', 'int', 'string', 'string']],
    // NFE_StatusServico(sResposta, esTamanho);
    NFE_StatusServico: ['int', ['pointer', 'string', 'string']],
    // NFE_Consultar( eChaveOuNFe, AExtrairEventos, sResposta, esTamanho);
    NFE_Consultar: ['int', ['pointer', 'string', 'bool', 'string', 'string']],
    // NFE_ConsultarRecibo(ARecibo, sResposta, esTamanho);
    NFE_ConsultarRecibo: ['int', ['pointer', 'string', 'string', 'string']],
    // NFE_ConsultaCadastro(cUF, nDocumento, nIE, sResposta, esTamanho);
    NFE_ConsultaCadastro: ['int', ['pointer', 'string', 'string', 'bool', 'string', 'string']],
    // NFE_Inutilizar(ACNPJ, AJustificativa, Ano, Modelo, Serie, NumeroInicial, NumeroFinal, sResposta, esTamanho);
    NFE_Inutilizar: ['int', ['pointer', 'string', 'string', 'int', 'int', 'int', 'int', 'int', 'string', 'string']],
    // NFE_Enviar( (ALote, AImprimir, ASincrono, AZipado, sResposta, esTamanho);
    NFE_Enviar: ['int', ['pointer', 'int', 'bool', 'bool', 'bool', 'string', 'string']],
    // NFE_Cancelar(eChave, eJustificativa, eCNPJ, ALote, sResposta, esTamanho);
    NFE_Cancelar: ['int', ['pointer', 'string', 'string', 'string', 'int', 'string', 'string']],
    // NFE_EnviarEvento(idLote, sResposta, esTamanho);
    NFE_EnviarEvento: ['int', ['pointer', 'int', 'string', 'string']],
    // NFE_DistribuicaoDFePorUltNSU(AcUFAutor, eCNPJCPF, eultNSU, sResposta, esTamanho);
    NFE_DistribuicaoDFePorUltNSU: ['int', ['pointer', 'int', 'string', 'string', 'string', 'string']],
    // NFE_DistribuicaoDFePorNSU(AcUFAutor, eCNPJCPF, eNSU, sResposta, esTamanho);
    NFE_DistribuicaoDFePorNSU: ['int', ['pointer', 'int', 'string', 'string', 'string', 'string']],
    // NFE_DistribuicaoDFePorChave(AcUFAutor, eCNPJCPF, eChave, sResposta, esTamanho);
    NFE_DistribuicaoDFePorChave: ['int', ['pointer', 'int', 'string', 'string', 'string', 'string']],
    // NFE_EnviarEmail(ePara, eXMLNFe, AEnviaPDF, eAssunto, eCC, eAnexos, eMensagem);
    NFE_EnviarEmail: ['int', ['pointer', 'string', 'string', 'bool', 'string', 'string', 'string', 'string']],
    // NFE_EnviarEmailEvento(ePara, eChaveEvento, eChaveNFe, AEnviaPDF, eAssunto, eCC, eAnexos, eMensagem);
    NFE_EnviarEmailEvento: ['int', ['pointer', 'string', 'string', 'string', 'bool', 'string', 'string', 'string', 'string']],
    // NFE_Imprimir([cImpressora], [nNumCopias], [cProtocolo], [bMostrarPreview], [cMarcaDagua], [bViaConsumidor], [bSimplificado]);
    NFE_Imprimir: ['int', ['pointer', 'string', 'int', 'string', 'string', 'string', 'string', 'string',]],
    // NFE_ImprimirPDF();
    NFE_ImprimirPDF: ['int', ['pointer']],
    // NFE_SalvarPDF(sResposta, esTamanho);
    NFE_SalvarPDF: ['int', ['pointer', 'string', 'string']],
    // NFE_ImprimirEvento(eArquivoXmlNFe, eArquivoXmlEvento);
    NFE_ImprimirEvento: ['int', ['pointer', 'string', 'string']],
    // NFE_ImprimirEventoPDF(eArquivoXmlNFe, eArquivoXmlEvento);
    NFE_ImprimirEventoPDF: ['int', ['pointer', 'string', 'string']],
    // NFE_SalvarEventoPDF(eArquivoXmlNFe, eArquivoXmlEvento);
    NFE_SalvarEventoPDF: ['int', ['pointer', 'string', 'string']],
    // NFE_ImprimirInutilizacao(eArquivoXml);
    NFE_ImprimirInutilizacao: ['int', ['pointer', 'string']],
    // NFE_ImprimirInutilizacaoPDF(eArquivoXml);
    NFE_ImprimirInutilizacaoPDF: ['int', ['pointer', 'string']],
    // NFE_SalvarInutilizacaoPDF(eArquivoXml);
    NFE_SalvarInutilizacaoPDF: ['int', ['pointer', 'string']],
});

Module not found: Can’t resolve ‘fs’ in Next.js application – bun compiler

I have several problems, first one I have to save in my mariadb an information from a PDF, I have been using libraries or trying with JS native to extract it and save it but its imposible. My project is a NEXT.js v14 but I compile with bun, its “similar” but not the same, because when I tried to download parsePdf it happened the message “Module not found: Can’t resolve ‘fs'”

I have been watching how to solve the problem with webpack 4-5 but not with bun.
For this problem the only solution I thought is create a micro service for this until the fs modulo wont be a problem

const arrayBufferToBuffer = (arrayBuffer) => {
 return Buffer.from(new Uint8Array(arrayBuffer)); 
};



const insertBlobData = async (files, attachmentID, userId) => { 
try { const fileList = Array.isArray(files) ? files : [files];

const fileRequests = fileList.map((file) => {
  const fileData = {
    blobID: generateUUID(),
    attachmentID,
    name: file.name,
    extension: 'pdf',
    data: arrayBufferToBuffer(file.data), // Convertimos el ArrayBuffer a Buffer
    createdBy: userId.providerID,
    createdAt: sqlFormattedDate(new Date()),
    updatedBy: null,
    updatedAt: null,
    erasedBy: null,
    erasedAt: null,
  };   
savedata ETC
}}

Next.js 15 App router api folder data dosen’t get

I want to get the value regions through Next.js’ App router, but I can’t get the data. I’m getting 404 and I don’t know what the problem is. Below is my code.

enter image description here
enter image description here

// src/app/api/regions/rotue.ts
import { NextResponse } from "next/server";

const regions = [
  { label: "서울", value: "seoul" },
  { label: "경기", value: "gyeonggi" },
  { label: "인천", value: "incheon" },
  { label: "대전", value: "daejeon" },
  { label: "대구", value: "daegu" },
  { label: "부산", value: "busan" },
  { label: "울산", value: "ulsan" },
  { label: "광주", value: "gwangju" },
  { label: "세종", value: "sejong" },
  { label: "강원", value: "gangwon" },
  { label: "충북", value: "chungbuk" },
  { label: "충남", value: "chungnam" },
  { label: "전북", value: "jeonbuk" },
  { label: "전남", value: "jeonnam" },
  { label: "경북", value: "gyeongbuk" },
  { label: "경남", value: "gyeongnam" },
  { label: "제주", value: "jeju" },
];

export async function GET() {
  return NextResponse.json(regions);
}
// src/app/page.tsx
async function getRegions() {
  const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/regions`, {
    cache: "no-store",
  });

  if (!res.ok) {
    throw new Error("Failed to fetch regions");
  }

  return res.json();
}

export default async function Home() {
  const regions = await getRegions();

  return (
    <div>
      {regions.map((region) => (
        <div key={region.value}>{region.label}</div>
      ))}
    </div>
  );
}

Somebody help me…

Once you test/route.js on the link, it comes out well when you approach the url input window with api/test..

But it doesn’t work when you approach the regions.

https://blog.logrocket.com/using-next-js-route-handlers/

Uncaught SyntaxError: Unexpected token ‘:’ (at abarth131.gltf?import:2:9)

so i’m trying to make a simple game with three.js
My first step here is loading a GLTF file, but gives me this error:
Uncaught SyntaxError: Unexpected token ‘:’ (at abarth131.gltf?import:2:9)

What i tried?
check the path
change the GLTF to public
in GLTF viewer the model loads normally

I dont know

here is my code:

let scene, camera, renderer, light

function init(){
  scene = new three.Scene()
  scene.background = new three.Color(0xdddddd)

  camera = new three.PerspectiveCamera(40, window.innerWidth/window.innerHeight,1 ,5000)
  light = new three.AmbientLight(0x404040, 100)
  scene.add(light)

  renderer = new three.WebGLRenderer({antialias:true})
  renderer.setSize(window.innerWidth, window.innerHeight)
  document.body.appendChild(renderer.domElement)

  let loader = new GLTFLoader()
  loader.load('../public/abarth131/abarth131.gltf', (gltf) => {
    scene.add(gltf.scene)
    renderer.render(scene,camera)
  })
}
init()

Im developing with Vite, in vanilla JS (sorry if my english is weird, i speak spanish)
Any help will be received!

EDIT: the error showed on chrome dev tools
enter image description here

Angular @Output/EventEmitter returns undefined

I have been trying to send data from a child component to a parent component in Angular. At the parent level, the prop keeps returning ‘undefined.’ I don’t know what I’m missing.

CHILD.component.ts

@Output()
  onGetDropdownItems: EventEmitter<any> = new EventEmitter<any>();
  getDropdownItems() {
    this.onGetDropdownItems.emit(this.dropdownItems)
  }

  /**
   * Sets the data for the Items per page select dropdown.
   */
  @Input()
  dropdownItems: [
    {
      optionValue: "5",
      optionText: "5",
    },
    {
      optionValue: "10",
      optionText: "10",
    },
    {
      optionValue: "20",
      optionText: "20",
    }
  ]

PARENT.component.ts

  @Input()
  dropdownItems: any;

  getDropdownItems(e: any) {
    this.dropdownItems = e;
    console.log('DROPDOWN ITEMS: ', e);
  }

  ngOnInit() {
    this.getDropdownItems(this.dropdownItems);
  }

PARENT.component.html

<cbds-pagination 
    (onGetDropdownItems)="getDropdownItems($event)">
</cbds-pagination>