Why isn’t text-decoration-thickness appearing in computed styles?

I have the below CSS:

example-element {
  text-decoration: underline 35px solid rgba(0, 76, 255, 0.52);
}

I expect to get text-decoration-thickness: 35px as part of the computed styles. However, when I check the computed styles using JavaScript:

console.log(window.getComputedStyle(document.querySelector('example-element')));

I get:

...    
    text-decoration-color: "rgba(0, 76, 255, 0.52)"
    text-decoration-line: "underline"
    text-decoration-skip-ink: "auto"
    text-decoration-style: "solid"
...

It doesn’t return text-decoration-thickness as a separate property like others.

Why is text-decoration-thickness not showing up in the computed styles, even though it’s part of the shorthand text-decoration? It seems like a clear oversight from Chrome, as if the developers aren’t taking this seriously. Chrome should include text-decoration-thickness in the computed styles. This is causing my system to break, and it’s unacceptable.

Any hacks to fix this issue temporary will be appreciated. Thanks.

Popper.js Adds Unintended 24px Offset with position: fixed

I’m encountering an issue when using Popper.js in conjunction with a fixed-positioned element.

Situation:

  • I have a <div> element with position: fixed and top: 24px:
    <div id="fixed-element" style="position: fixed; top: 24px;">
      <!-- Content -->
    </div>
    
  • Below this element, I place another <div> that I want to position using Popper.js with strategy: 'fixed':
    const reference = document.querySelector('#fixed-element');
    const popper = document.createElement('div');
    document.body.appendChild(popper);
    
    Popper.createPopper(reference, popper, {
      strategy: 'fixed',
      modifiers: [
        {
          name: 'offset',
          options: {
            offset: [0, 10],
          },
        },
      ],
    });
    

Problem:
When I apply Popper.js, it automatically adds the existing 24px from the top property to the specified offset. This results in the popper element being positioned 24px lower than intended. I want Popper to account for the existing 24px and only apply the specified offset.

Question:
Is there a way to configure Popper.js to consider the 24px top position, or can I retrieve this value and adjust the offset manually? Alternatively, is there a better approach to handle this positioning with fixed elements?

Failed to implement send confirmation email functionality

I use form to verify the email with emailjs, sending the email value to next.js API. In the API route.js I create and hash token, store it in database and make a confirmation link(so far the console.logs are giving my that everything is ok) and then in the sendEmail (which I use in another form and it works)function I receive: “Email send failed: undefined
portfolio3d-nextjs-app-1 | Failed to send email: Error: Failed to send email
portfolio3d-nextjs-app-1 | at sendEmail (webpack-internal:”.
Another info I use Docker image to run my project.
Can someone give me advice how to solve this problem?

'use client';
import React from 'react';
import { useForm } from 'react-hook-form';
import { Toaster, toast } from 'sonner';
import { MailCheck, MailX } from 'lucide-react';

export default function EmailConfirmationForm() {
    const { register, handleSubmit, formState: { errors }, reset } = useForm();

    // Send confirmation email
    const handleSendConfirmationEmail = async (email) => {
        try {
            const response = await fetch(`/api/sendConfirmationEmail?email=${email}`, {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                },
                body: JSON.stringify({ email }),
            });
            if (!response.ok) throw new Error('Failed to send confirmation email');
            toast.success('Confirmation email sent!', {
                duration: 5000,
                icon: <MailCheck />,
                style: {
                    backgroundColor: '#1B1B1B',
                    border: 'none',
                },
            });
            return true;
        } catch (error) {
            toast.error('Failed to send confirmation email.', {
                duration: 5000,
                icon: <MailX />,
                style: {
                    backgroundColor: '#1B1B1B',
                    border: 'none',
                },
            });
            return false;
        }
    };

    const onSubmit = async (data) => {

        try {
            await handleSendConfirmationEmail(data.email);

            reset(); 
        } catch (error) {
            console.error('Failed to send confirmation email:', error);
        }
    };

    return (
        <>
            <Toaster position="bottom-left" richColors />
            <form onSubmit={handleSubmit(onSubmit)} className="max-w-md w-full flex flex-col items-center justify-center space-y-4">

                {/* Email input */}
                <label htmlFor="email" className="self-start">Email Confirmation</label>
                <input
                    id="email"
                    type="email"
                    placeholder="Email Confirmation"
                    {...register("email", {
                        required: 'This field is required',
                        pattern: { value: /^S+@S+$/i, message: 'Invalid email format' }
                    })}
                    className="w-full p-2 rounded-md shadow-lg text-foreground focus:outline-none focus:ring-2 focus:ring-accent/50 custom-bg"
                    aria-label="Email"
                />
                {errors.email && <span className="inline-block self-start text-red-500">{errors.email.message}</span>}

                <input
                    value="Cast your message!"
                    className="px-10 py-4 rounded-md shadow-lg bg-background border border-accent/30 hover:shadow-glass-sm backdrop-blur-sm text-foreground focus:outline-none focus:ring-2 focus:ring-accent/50 cursor-pointer capitalize"
                    type="submit"
                />
            </form>
        </>
    );
}
import { NextResponse } from 'next/server';
import { sendEmail } from '@/app/../../service/service.email';
import redisClient, { connectRedis } from '@/app/../../service/redisClient';
import { generateToken, hashToken } from '@/app/../../service/tokenService';
import { rateLimiter } from '@/app/../../service/rateLimiter';

export async function POST(req) {
    const { searchParams } = new URL(req.url);
    const email = searchParams.get('email');
    const ip = req.headers.get('x-forwarded-for') || req.socket.remoteAddress || req.ip;

    // if (!rateLimiter(ip)) {
    //     return NextResponse.json({ message: 'Too many requests, please try again later.' }, { status: 429 });
    // }

    await connectRedis();

    const token = generateToken();
    const hashedToken = await hashToken(token);

    const expiresAt = Date.now() + 3600 * 1000;

    try {
        await redisClient.setEx(`confirm_tokens:${hashedToken}`, 3600, JSON.stringify({ email, expiresAt }));
        const storedToken = await redisClient.get(`confirm_tokens:${hashedToken}`);
        console.log('Token stored in Redis:', storedToken); // Log to verify storage
    } catch (redisError) {
        console.error('Error saving token in Redis:', redisError);
        return NextResponse.json({ message: 'Error saving confirmation token to Redis.' }, { status: 500 });
    }

    const confirmationLink = `${process.env.NEXT_PUBLIC_APP_URL}/api/confirmEmail?token=${token}&email=${email}`;
    console.log(`Confirmation link: ${confirmationLink}`);
    try {
        const templateParams = {
            to: email,
            from_name: 'Email Confirmation',
            reply_to: email,
            message: `Please confirm your email by clicking the link: ${confirmationLink}`,
        };

        await sendEmail(templateParams);

        return NextResponse.json({ message: 'Confirmation email sent!' }, { status: 200 });
    } catch (error) {
        console.error('Failed to send email:', error);
        return NextResponse.json({ message: 'Failed to send confirmation email.' }, { status: 500 });
    }
}
import emailjs from '@emailjs/browser';

export const sendEmail = async (params) => {
    try {
        const response = await emailjs.send(
            process.env.NEXT_PUBLIC_SERVICE_ID,
            process.env.NEXT_PUBLIC_TEMPLATE_ID,
            params,
            {
                publicKey: process.env.NEXT_PUBLIC_PUBLIC_KEY,
                limitRate: {
                    throttle: 5000,
                },
            }
        );
        console.log('Email sent successfully:', response);
        return response;  
    } catch (error) {
        console.error('Email send failed:', error.text);
        if (error.response) {
            console.error('Error response from email service:', error.response);
        }
        throw new Error(error.text || 'Failed to send email');
    }
};

Random Jekyll javascript carousel: how to avoid repetition in sequence?

I’ve been developing a very simple website with Jekyll with a random carousel on home.
I would like to avoid repetition of image before all images in the stack have been shown.
This is the code I’m using:

<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <style>
    .carousel__holder {
        width: 100%;
        position: relative; 
        margin-top: 3em;
        margin-left: auto; 
        margin-right: auto;
        padding: 5px;
        margin: 1rem 0 1rem;
            }

    .carousel {
        max-width: 80%;
        max-height: 100%;
        object-fit: cover;
        margin-left: auto; 
        margin-right: auto;
        overflow: hidden;
        text-align: center;
        position: absolute;
        display: block;
        }

    .carousel__slide {
        max-height: 100%;
        max-width: 100%;
        opacity: 0;
        display: block;
        }   
            
    .carousel__slide .overlay {height: 100%;}
    .carousel--thumb .carousel__indicator {
        height: 30px;
        width: 30px;
        }
    </style>
</head>


<body>
    
<div class="carousel_holder" id="carousel_holder">
    {% assign image_files = site.static_files| where: "image", true %}
    {% for image in image_files %}
            <img src="{{ image.path }}" class="carousel" alt="image">
    {% endfor %}
</div>
    
  <script>
    let a = [];
    for (let i = 0; i < 85; ++i) a[i] = i;

    // http://stackoverflow.com/questions/962802#962890
    function shuffle(array) {
      let tmp, current, top = array.length;
      if (top)
        while (--top) {
          current = Math.floor(Math.random() * (top + 1));
          tmp = array[current];
          array[current] = array[top];
          array[top] = tmp;
        }
      return array;
    }

    a = shuffle(a);
    var myIndex = 0;

    carousel();

    function carousel() {

      var i;

      var x = document.getElementsByClassName("carousel");

      myTimeout = setTimeout(carousel, 1800);

      for (i = 0; i < x.length; i++) {
        x[i].style.display = "none";
      }

      myIndex++;

      if (myIndex > x.length) {
        a = shuffle(a);
        myIndex = 1
      }
      x[a[myIndex - 1]].style.display = "block";

      // COMMENTED AS IT'S NOT A LEGAL FN: document.getElementByClass("thewellContainer").style.color = "transparent";

}

    
</script>

</body>

Can you please give me some advice on how to implement thi feature on javascript?
Thank you for your help

Error while run the project, error are mentioned in image [closed]

enter image description here

enter image description here

I am buid one project using angular and i made backend using .net. Firstly i am start the server then
i am go for run the angular project. In vs code command line it starts properly angular project. But i’m facing an issue in browser which are i am mentioned in image. I am also tried various browsers for run the project like Edge, chrome, Mozila, but still i’m having same type of error.

React E-commerce Shop, products not staying when login out of an account

SO im trying to get the products selected to appear in my Cart Page even if a I log out of the account, that they stay in the database for the respective user. But i think is because of the variable size that impeeding that, I was trying to add but being novice in react and mongo db failed.

I tried changing the db but atlas on my websitedidn’t update…

The mongo db code as of now

//Create API for user
const Users = mongoose.model('Users', {
    name:{
        type: String,
    },
    email:{
        type: String,
        unique:true,
    },
    password:{
        type:String,
    },
    cartData:{
        type:Object,
    },

    date:{
        type:Date,
        default:Date.now,
    }
})

And I changed it to this in my back end

const Users = mongoose.model('Users', { 
    name: {
        type: String,
    },
    email: {
        type: String,
        unique: true,
    },
    password: {
        type: String,
    },
    cartData: {
        type: Map,
        of: {
            type: Object,
            default: {
                S: { type: Number, default: 0 },
                M: { type: Number, default: 0 },
                L: { type: Number, default: 0 },
                XL: { type: Number, default: 0 },
                XXL: { type: Number, default: 0 },
            },
        },
    },
    date: {
        type: Date,
        default: Date.now,
    },
});

My addtocart API

// Endpoint to add products to cart data
app.post('/addtocart', fetchUser, async (req, res) => {

    console.log("added", req.body.jerseyId);
    try {
        const { jerseyId } = req.body;
        
        if (!jerseyId) {
            return res.status(400).json({ error: "Item ID is required" });
        }

        let userData = await Users.findOne({ _id: req.user.id });

        // Initialize the item in the cart if it doesn’t exist
        if (!userData.cartData[jerseyId]) {
            userData.cartData[jerseyId] = 0;
        }

        userData.cartData[jerseyId] += 1;

        await Users.findOneAndUpdate({ _id: req.user.id }, { cartData: userData.cartData });
        
        res.json({ success: true, message: "Item added to cart successfully" });
    } catch (error) {
        console.error("Error adding item to cart:", error);
        res.status(500).json({ success: false, message: "An error occurred while adding the item to the cart" });
    }
});

front-end that calls API

const addToCart = (jerseyId, size) => {
    setCartItems((prev) => ({
        ...prev,
        [jerseyId]: {
            ...prev[jerseyId],
            [size]: (prev[jerseyId][size] || 0) + 1, // Increment the quantity for the selected size
        },
    }));

    if (localStorage.getItem('auth-token')) {
        fetch('http://localhost:4000/addtocart', {
            method: 'POST',
            headers: {
                Accept: 'application/json',
                'auth-token': localStorage.getItem('auth-token'),
                'Content-Type': 'application/json',
            },
            body: JSON.stringify({ jerseyId, size }), // Now sending both jerseyId and size
        })
        .then(response => response.json())
        .then(data => console.log(data));
    }
};

How cart page look (just in case)

import React, { useContext } from 'react';
import './CartItems.css'; // Importing the CSS file for styling.
import { ShopContext } from '../../Context/ShopContext'; // Importing ShopContext to access cart-related functions and data.
import remove_icon from '../Assets/remove_icon.jpg'; // Remove item icon.

const CartItems = () => {
    const { getTotalCartAmount, every_product, cartItems, removeFromCart } = useContext(ShopContext); // Accessing cart context.

    return (
        <div className='cartitems'>
            {/* Header row for cart item details */}
            <div className="cartitems-format-main">
                <p>Products</p>
                <p>Title</p>
                <p>Size</p> {/* Added Size column */}
                <p>Price</p>
                <p>Quantity</p>
                <p>Total</p>
               {/*  <p>Remove</p> */}
            </div>
            <hr />

            {/* Mapping over the products to display each cart item */}
            {every_product.map((e) => {
                // Check if there is any item of this product in the cart for any size
                const productInCart = Object.keys(cartItems[e.id]).filter(size => cartItems[e.id][size] > 0);

                // Only display products with a quantity greater than 0 for any size
                return productInCart.length > 0 ? (
                    <div key={e.id}>
                        {productInCart.map((size) => (
                            <div className="cartitems-format cartitems-format-main" key={size}>
                                {/* Product image */}
                                <img 
                                    src={e.image || 'default_image_path.jpg'} 
                                    alt={e.name} 
                                    className='carticon-product-icon' 
                                />
                                <p>{e.name}</p> {/* Product name */}
                                <p>{size}</p> {/* Display selected size */}
                                <p>${e.us_cost}</p> {/* Product price */}

                                {/* Quantity button */}
                                <button className='cart-items-quantity'>
                                    {cartItems[e.id][size]} {/* Display quantity for the selected size */}
                                </button> 

                                {/* Total price for the product based on quantity and size */}
                                <p>${e.us_cost * cartItems[e.id][size]}</p>

                                {/* Remove from cart button */}
                                <img 
                                    src={remove_icon} 
                                    onClick={() => removeFromCart(e.id, size)} 
                                    alt="Remove item" 
                                    className='cart-items-remove-icon' 
                                />
                            </div>
                        ))}
                        <hr />
                    </div>
                ) : null; // Explicitly return null if no items for this product
            })}
            
            {/* Section for cart total and checkout */}
            <div className="cart-items-down">
                <div className="cartitems-total">
                    <h1>Totals</h1>
                    <div>
                        {/* Subtotal */}
                        <div className="cartitems-total-item">
                            <p>Subtotal</p>
                            <p>${getTotalCartAmount()}</p> {/* Total cost of all items in the cart */}
                        </div>
                        <hr />
                        
                        {/* Shipping fee */}
                        <div className="cartitems-total-item">
                            <p>Shipping Fee</p>
                            <p>Free Shipping!</p>
                        </div>    
                        <hr />
                        
                        {/* Grand total */}
                        <div className="cartitems-total-item">
                            <h3>Total</h3>
                            <h3>${getTotalCartAmount()}</h3> {/* Grand total after shipping */}
                        </div>
                    </div>
                    
                    {/* Proceed to checkout button */}
                    <button className="cart-items-checkout-button">PROCEED TO CHECKOUT</button>
                </div>
            </div>
        </div>
    );
};

export default CartItems;

How create uncontroled TextInput on React Native

I need to get the value of TextInput via ref.
But if I bind a mutable ref object to the ref property of TextInput, then I can’t get the value property via ref object, because this property doesn’t exist in ref object.

How can I solve this?

Is it allowed to create a second ref object and assign a value to it when the TextInput text changes?

I tried to write the value to the same ref object, but I get an error:

Property ‘value’ does not exist on type ‘TextInput’

import { useRef, useState } from "react";
import { Text, TextInput, View, StyleSheet, TouchableOpacity, Pressable, GestureResponderEvent } from "react-native";

export default function Index() {
  const taskNameInputRef = useRef<TextInput | null>(null);

  const handlePress = () => {
    console.log(taskNameInputRef.current.value);
  }

  return (
    <View
      style={{
        flex: 1,
        justifyContent: "center",
        alignItems: "center",
      }}
    >
      <TextInput
        style={styles.input}
        ref={taskNameInputRef}
        placeholder="Enter task name"
        onChangeText={(text) => {
          if (taskNameInputRef.current) {
            taskNameInputRef.current.value = text; // 
          }
        }}
      />
    </View>
  );
}

Also, the method via access to the ref object via taskNameInputRef.current._lastNativeText does not work. _lastNativeText – doesn’t exist.

Micromark conversion of markdwon text to html is converting html characters to html entities

I am using micromark to convert markdown text to html. It appears to be sanitizing html and I’m not sure how to disable it. For example this code:

import { micromark } from 'micromark';
import { gfm, gfmHtml } from 'micromark-extension-gfm';

const mdd = `
# Title
<div>
  This is HTML inside markdown.
  <img src="image.jpg" alt="Example image" />
</div>
`;
console.log(micromark(mdd, { extensions:[ gfm() ] }));

Results in this output

<h1>Title</h1>
&lt;div&gt;
  This is HTML inside markdown.
  &lt;img src=&quot;image.jpg&quot; alt=&quot;Example image&quot; /&gt;
&lt;/div&gt;

When I was hoping to get

<h1>Title</h1>
<div>
  This is HTML inside markdown.
  <img src="image.jpg" alt="Example image" />
</div>

Any tips on how I can make that work

How to extend a method on a custom interface

Consider the below example extending the string prototype.

globals.d.ts:

declare interface String {
 getCropUrl(): string;
}

helpers.ts:

String.prototype.getCropUrl = function (): string {
 let d = String(this);
 return "https://localhost:44361" + d;
}

app.tsx:

...
console.log(content.properties.image.url)
//output: /media/test_image.jpg

console.log(content.properties.image.url.getCropUrl())
//output: https://localhost:44361/media/test_image.jpg
...

In an attempt to extend a custom interface, I either get all green lights in Visual Studio only to receive an error when viewing the site “getCropUrl() is not a function” or when trying to make parts global I find issues and red lights back in Visual Studio. Something along the lines of:

interfaces.ts:

interface IImage {
 height: number,
 url: string,
 width: number,
 getCropUrl(): string
}

globals.d.ts:

declare interface IImage {
 getCropUrl(): string;
}

helpers.ts:

IImage.prototype.getCropUrl = function (): string {
 let d = IImage(this);
 return "https://localhost:44361" + d.url;

// Both IImage is red underlined and has the complaint:
// "'IImage' only refers to a type, but is being used as a value here."
}

app.tsx:

...
console.log(content.properties.image)
//output: {
// height: 500,
// url: '/media/test_image.jpg',
// width: 1200
//}

console.log(content.properties.image.getCropUrl())
//TypeError: image.getCropUrls is not a function 
...

This is a Next.js app pulling data from an API of which I cannot control the output.

I’ve also tried to declare global around the interface in global.d.ts but this seems to have an even more negative effect in that all instances of IImage become red underlined.

I’m assuming that the success from extending the String interface is due to something else happening in the background which I need to also do for IImage, I’m just not sure what this something might be.

Trapping a function call with a proxy does not intercept the arguments

I want to intercept function calls and found that proxies can do that as shown here on MDN using the apply method. However what I quickly found out is that the params passed to the function are not intercepted so if you have params that can be expressions like in the case of tagged template literals for example the apply method does not intercept the execution of the tagged template and it`s expressions, why is that and is there any way to do that other than creating a wrapper function? I think the arguments should be intercepted as well feels like a bug in the proxy implementation to me.

// create tagged template function
function template(strings, ...keys) {
 console.log("tmp fn");
 
  return (...values) => {
    const dict = values[values.length - 1] || {};
    const result = [strings[0]];
    keys.forEach((key, i) => {
      const value = Number.isInteger(key) ? values[key] : dict[key];
      result.push(value, strings[i + 1]);
    });
    return result.join("");
  };
}

// Trapping a function call with proxy 
const taggedTemplate = new Proxy(template, {
  apply(target, thisArg, argArray) {
    console.log("apply");
    return target(...argArray)
  }
});

// some fn for the template
function Num() {
 console.log("Not intercepted Num() call")
 return 5
};

// use template
taggedTemplate`my fav number is ${Num()}`

Firebase Phone Authentication Error: FirebaseError: Firebase: Error (auth/internal-error)

I’m trying to implement Firebase phone authentication in my chrome web extension.
Everything works fine on the web, but when implementing it in a web extension, I am encountering the following error:

PhoneAuth.js:
Error sending OTP: FirebaseError: Firebase: Error (auth/internal-error).
Here is the code I’m using for Firebase phone authentication:

javascript


import React, { useState } from 'react';
import { auth } from './firebaseConfig';
import { RecaptchaVerifier, signInWithPhoneNumber, PhoneAuthProvider, signInWithCredential } from 'firebase/auth';

const PhoneAuth = () => {
  const [phoneNumber, setPhoneNumber] = useState('');
  const [otp, setOtp] = useState('');
  const [verificationId, setVerificationId] = useState(null);
  const [error, setError] = useState('');
  const [message, setMessage] = useState('');

  const setupRecaptcha = () => {
    if (!window.recaptchaVerifier) {
      window.recaptchaVerifier = new RecaptchaVerifier(auth, 'recaptcha-container', {
        'size': 'invisible', // Invisible reCAPTCHA
        'callback': (response) => {},
        'expired-callback': () => {
          console.log('reCAPTCHA expired.');
        }
      });
    }
  };

  const sendOtp = async () => {
    try {
      setError('');
      setMessage('');
      setupRecaptcha();
      const appVerifier = window.recaptchaVerifier;
      const formattedPhoneNumber = `+${phoneNumber.replace(/D/g, '')}`;
      const confirmationResult = await signInWithPhoneNumber(auth, formattedPhoneNumber, appVerifier);
      setVerificationId(confirmationResult.verificationId);
      setMessage('OTP sent successfully');
    } catch (err) {
      if (err.customData) {
        console.error('Custom data:', err.customData);
      }
      setError(`Error sending OTP: ${err.message}`);
      // Reset reCAPTCHA
      if (window.recaptchaVerifier) {
        try {
          await window.recaptchaVerifier.clear();
          window.recaptchaVerifier = null;
          setupRecaptcha();
        } catch (clearError) {
          console.error('Error clearing reCAPTCHA:', clearError);
        }
      }
    }
  };

  return (
      <div style={{ margin: '20px' }}>
        <h2>Phone Authentication</h2>
        <div id="recaptcha-container"></div>

        <input
          type="text"
          placeholder="Enter phone number with country code (e.g., +1234567890)"
          value={phoneNumber}
          onChange={(e) => setPhoneNumber(e.target.value)}
          style={{ marginBottom: '5px' }}
        />
        <button onClick={sendOtp}>Send OTP</button>
        {message && <p style={{ color: 'green' }}>{message}</p>}
        {error && <p style={{ color: 'red' }}>{error}</p>}
      </div>
  );
};

export default PhoneAuth;

Things I’ve tried:
Ensured reCAPTCHA is set up properly: I’ve included a hidden reCAPTCHA widget and am initializing it in the setupRecaptcha function.
Phone number formatting: I’m ensuring the phone number has a valid international format by using +${phoneNumber.replace(/D/g, ”)}.
Checked Firebase project settings: The Firebase project is set up for phone authentication, and I’ve confirmed that the reCAPTCHA domain matches.
Error Description:
I’m able to initiate the OTP sending process, but the following error occurs when the sendOtp function is executed:
FirebaseError: Firebase: Error (auth/internal-error).

What I’m trying to achieve:
I want to send an OTP to the user’s phone and verify it using Firebase Phone Authentication in my web extension). However, I am unable to send the OTP due to the error above.

Request for help:
Why am I seeing this error (auth/internal-error) when trying to send the OTP?
Is there any Firebase-specific setting that could be causing this issue in chrome extension?
Are there any common mistakes that I might have missed in the setup for Firebase phone authentication?

I appreciate any help or insights!

I want to send an OTP to the user’s phone and verify it using Firebase Phone Authentication in my web extension). However, I am unable to send the OTP due to the error above.

Lambda function to PutRecord on Kinesis Stream ETIMEDOUT Error

I am writing a very simple lambda in JS. Its main purpose is to take the message from SQS (that i am triggering manually from AWS console) and then publish to kinesis stream through a put record. I have given the required permission to the lambda for PutRecord. But most of the time i am getting the below error.

  "errorType": "Runtime.UnhandledPromiseRejection",
  "errorMessage": "Error [ERR_HTTP2_STREAM_CANCEL]: The pending stream has been canceled (caused by: connect ETIMEDOUT 34.223.45.15:443)",
  "trace": [
    "Runtime.UnhandledPromiseRejection: Error [ERR_HTTP2_STREAM_CANCEL]: The pending stream has been canceled (caused by: connect ETIMEDOUT 34.223.45.15:443)",
    "    at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)",
    "    at process.emit (node:events:517:28)",
    "    at emit (node:internal/process/promises:149:20)",
    "    at processPromiseRejections (node:internal/process/promises:283:27)",
    "    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"
  ]
}

However surprisingly sometimes it would work too especially when i deploy by changing the partitionKey to a different random value.

import { KinesisClient, PutRecordCommand } from "@aws-sdk/client-kinesis";

export const KINESIS_CLIENT = new KinesisClient([
  {
    httpOptions: {
      connectTimeout: 10000,
    },
    maxRetries: 1,
    region: 'us-west-2',
  },
]);

export const handler = async (event) => {

  const promises = [];

  for (const {messageId, body} of event.Records) {
    processEvent(body)
    promises.push(processEvent(body));
  }

  const responses = await Promise.allSettled(promises);
  responses.forEach((response) => {
    if (response.status !== "fulfilled") {
      throw Error(JSON.stringify(responses));
    }
  });
};

export async function processEvent(body) {
  const newBody = JSON.parse(body);
  newBody['field'] = 'Random';

  await KINESIS_CLIENT.send(
      new PutRecordCommand({
        Data: new TextEncoder().encode(JSON.stringify(newBody)),
        StreamName: 'InputEventStream',
        PartitionKey: '3', <--- I change this and sometimes after redeployment it seems to work
      }),
  );
}```

Animated hamburger icon inside button

I’m trying to create responsive navbar. And I want it with accessibility standards. So, for example, user should be able to navigate the site by using keyboard.

I also want animated hamburger icon. Something really simple, like this: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_menu_icon_js

But above solution isn’t semantic at all. And user can’t use keyboard (so I want to handle not only ‘click’ event by mouse, but also ‘enter’ or ‘space’ from keyboard).
I’ve just read, that I should use button for this purposes, not just link or (what’s worse) a div. (note that on stackoverflow site, hamburger icon isn’t inside button, it’s only a link – why?)

From a short research I know, that inside button I can use span, but not div. And I’m not sure if it is okay to set display property, on span placed inside the button, as a block? I think that I need that block property to make my animated hamburger icon.

Any ideas on that?

TEXTURE_2D_ARRAY not outputing texture in Webgl’s OGL

I have a tiled image, 960px (w) x 1620px (h), with each block being 540px high, that I want to sample with sampler2DArray. I believe I am doing everything correctly but no texture is displayed. What could be wrong?

Frag shader:

uniform highp sampler2DArray uTex;

varying vec2 vUv;
varying vec3 vNormal;

void main() {
    vec2 uv = vUv;
    vec3 color = texture( uTex, vec3( uv, 0. ) ).rgb;    
    gl_FragColor = vec4( color, 1.);
}

And this is how I am loading the image:

this.geometry = new Plane(this.gl);

    let vertPrefix = this.renderer.isWebgl2
    ? /* glsl */ `#version 300 es
      #define attribute in
      #define varying out
      #define texture2D texture`
    : ``;

    let fragPrefix = this.renderer.isWebgl2
    ? /* glsl */ `#version 300 es
      precision highp float;      
      #define varying in
      #define texture2D texture
      #define gl_FragColor FragColor
      out vec4 FragColor;
    `
    : `
      #extension GL_OES_standard_derivatives : enable
      precision highp float;
    `;


    this.tex = new Texture( this.gl, {
      target: this.gl.TEXTURE_2D_ARRAY,      
      level: 3,
      width: 960,
      height: 540,
      flipY: true,
    } );
    
    
    let img = new Image();
    img.src = './src/images/anim2.jpg';
    img.onload = () => {
      this.tex.image = img;      
      this.tex.needsUpdate = true;
    }

    this.program = new Program(this.gl, {
        vertex: vertPrefix + defines + vert,
        fragment: fragPrefix + defines + frag,
        uniforms: {
            uTime: { value: this.speed },
            uResolution: { value: new Vec2( this.gl.canvas.width, this.gl.canvas.height ) },
            uTex: { value: this.tex }
        },
    });

I also tried with the new Texture3D class but to no avail. And why does the desired output requires more rows than 1620 if I pass length 3 and height 540, i.e. 1620/3?

This is OGL’s Texture class.

This is the image:
enter image description here

Running single line Typescript file without transpiling

I am a newbie in TS & want to run a single line programme directly without tanspiling via ts-node
These are my specs
image

I ran below command

npm install -g typescript
npm install -g ts-node

This is my code

Console.log("Hello World");

I am getting below error

PS G:New folder> ts-node "g:New folderSession1.ts"
(node:5020) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
g:New folderSession1.ts:2
export {};
^^^^^^

SyntaxError: Unexpected token 'export'
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1178:20)
    at Module._compile (node:internal/modules/cjs/loader:1220:27)
    at Module.m._compile (C:UsersuserAppDataRoamingnpmnode_modulests-nodesrcindex.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Object.require.extensions.<computed> [as .ts] (C:UsersuserAppDataRoamingnpmnode_modulests-nodesrcindex.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Function.Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at phase4 (C:UsersuserAppDataRoamingnpmnode_modulests-nodesrcbin.ts:649:14)

image

I am not doing any import nothing, I think it should work without package.json file and even after adding package.json file the problem still persists….Please help me with this.

Thank You