rhh4x0R
rhh4x0R
Explore posts from servers
RRailway
Created by rhh4x0R on 10/24/2024 in #✋|help
Node-Gyp Error Docker React App
Hey y'all, I'm trying to build a react app but I'm not able to install node-gyp for some reason. I saw there's responses about using Nix, but I'd rather use Docker. I've tried a bunch of different apk scripts but still no luck. I've also tried using different node versions, any ideas? Dockerfile:
FROM node:lts-alpine3.17 AS builder

# Install dependencies including Python
RUN apk add --no-cache python3 py3-pip make g++ \
&& ln -sf python3 /usr/bin/python \
&& ln -sf pip3 /usr/bin/pip

# set the working directory
WORKDIR /app

# copy the package.json and package-lock.json files
COPY package.json .
COPY package-lock.json .

# install the dependencies
RUN npm ci

# copy the rest of the files
COPY . .

# build the app
RUN npm run build

# set the command to run the app
CMD ["npm", "run", "start"]
FROM node:lts-alpine3.17 AS builder

# Install dependencies including Python
RUN apk add --no-cache python3 py3-pip make g++ \
&& ln -sf python3 /usr/bin/python \
&& ln -sf pip3 /usr/bin/pip

# set the working directory
WORKDIR /app

# copy the package.json and package-lock.json files
COPY package.json .
COPY package-lock.json .

# install the dependencies
RUN npm ci

# copy the rest of the files
COPY . .

# build the app
RUN npm run build

# set the command to run the app
CMD ["npm", "run", "start"]
Error
#10 44.93 npm ERR! code 1

#10 44.93 npm ERR! path /app/node_modules/usb

#10 44.93 npm ERR! command failed

#10 44.93 npm ERR! command sh -c node-gyp-build

#10 44.93 npm ERR! make: Entering directory '/app/node_modules/usb/build'

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/core.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/io.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/sync.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/os/events_posix.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o

#10 44.94 npm ERR! make: Leaving directory '/app/node_modules/usb/build'

#10 44.94 npm ERR! gyp info it worked if it ends with ok

#10 44.94 npm ERR! gyp info using [email protected]

#10 44.94 npm ERR! gyp info using [email protected] | linux | x64

#10 44.94 npm ERR! gyp info find Python using Python version 3.10.15 found at "/usr/bin/python3"

#10 44.94 npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz

#10 44.94 npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz

#10 44.94 npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v20.10.0/SHASUMS256.txt

#10 44.94 npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v20.10.0/SHASUMS256.txt
#10 44.93 npm ERR! code 1

#10 44.93 npm ERR! path /app/node_modules/usb

#10 44.93 npm ERR! command failed

#10 44.93 npm ERR! command sh -c node-gyp-build

#10 44.93 npm ERR! make: Entering directory '/app/node_modules/usb/build'

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/core.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/io.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/sync.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/os/events_posix.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o

#10 44.93 npm ERR! CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o

#10 44.94 npm ERR! make: Leaving directory '/app/node_modules/usb/build'

#10 44.94 npm ERR! gyp info it worked if it ends with ok

#10 44.94 npm ERR! gyp info using [email protected]

#10 44.94 npm ERR! gyp info using [email protected] | linux | x64

#10 44.94 npm ERR! gyp info find Python using Python version 3.10.15 found at "/usr/bin/python3"

#10 44.94 npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz

#10 44.94 npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz

#10 44.94 npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v20.10.0/SHASUMS256.txt

#10 44.94 npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v20.10.0/SHASUMS256.txt
16 replies
TtRPC
Created by rhh4x0R on 10/23/2024 in #❓-help
Getting CORS error with tRPC express adapter, locally
No description
4 replies
RRailway
Created by rhh4x0R on 4/24/2024 in #✋|help
ENV Vars Not Accessible On Deployment
Attempting to deploy Astro app via Railway and seems like no ENV vars are being exposed. Dockerfile as requested by @Brody
FROM node:18.16 AS base
WORKDIR /app

COPY package.json package-lock.json ./

FROM base AS build
RUN npm ci

COPY . .
RUN npm run build

FROM base AS runtime

COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist

# Move the drizzle directory to the runtime image
COPY --from=build /app/drizzle ./drizzle

# Create the data directory for the database
RUN mkdir -p /data

ENV HOST=0.0.0.0
ENV PORT=4321
ENV NODE_ENV=production
EXPOSE 4321

CMD node ./dist/server/entry.mjs
FROM node:18.16 AS base
WORKDIR /app

COPY package.json package-lock.json ./

FROM base AS build
RUN npm ci

COPY . .
RUN npm run build

FROM base AS runtime

COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist

# Move the drizzle directory to the runtime image
COPY --from=build /app/drizzle ./drizzle

# Create the data directory for the database
RUN mkdir -p /data

ENV HOST=0.0.0.0
ENV PORT=4321
ENV NODE_ENV=production
EXPOSE 4321

CMD node ./dist/server/entry.mjs
52 replies
TtRPC
Created by rhh4x0R on 4/11/2024 in #❓-help
tRPC + React Query Data Invalidation?
Hey y'all, I'm working with tRPC and React Query and just trying to understand how this works. I have a call that basically sees if the server is online or offline, however, when I disconnect the server I'll get the error eventually on the client, but it won't nullify the query data. Is that normal? Perhaps it just keeps it in the cache -- can I invalidate it to get the proper info? Ex. it'll show online when it's up, but when I turn it off it'll show... error fetching online Not sure why that's the case here.
const query = trpcReact.health.useQuery();

return (
<>
<h1>Dashboard</h1>
{query.isLoading ? 'loading...' : null }
{query.isError ? 'error' : null }
{query.isFetching ? 'fetching' : 'not fetching'}
{query.data != null && query.data.ok ? 'online' : 'offline'}
const query = trpcReact.health.useQuery();

return (
<>
<h1>Dashboard</h1>
{query.isLoading ? 'loading...' : null }
{query.isError ? 'error' : null }
{query.isFetching ? 'fetching' : 'not fetching'}
{query.data != null && query.data.ok ? 'online' : 'offline'}
9 replies
TTCTheo's Typesafe Cult
Created by rhh4x0R on 1/4/2024 in #questions
uploadingThing without UI?
Hey all, I'm trying to use uploadthing without a frontend. I'd basically make a csv file and then upload it to uploadthing. I'm having trouble with the syntax as I don't need a router (I think) or middleware -- just want to upload the file. Is this possible?
6 replies
DIAdiscord.js - Imagine an app
Created by rhh4x0R on 12/30/2023 in #djs-questions
Removing bot from servers
Hey y'all, I'm trying to remove my bot from quite a few servers. I'm running a script from my computer that logs into the bot and finds the cache, then leaves them. It seemed to have temp banned my personal IP (and not my bot), due to rate limiting I'm sure. What's the best way to go about getting this bot out of many differnet servers?
27 replies
RRailway
Created by rhh4x0R on 12/7/2023 in #✋|help
API Crashes with No Logs
Hey y'all, I've got a golang API (Fiber) that I've launched in Railway. Everything seems to be working fine, however after a few hours the app crashes and doesn't restart. There's nothing in the logs that shows when it crashes. Restart Policy is to restart on failure (10 max-retries) but that doesn't seem to be happening either. Any ideas? Project ID: 34f75a65-aa33-477d-a9a7-086c5c19edf4
11 replies
TtRPC
Created by rhh4x0R on 8/24/2023 in #❓-help
How do pass a 'blob' from frontend to backend?
I'm having trouble doing this without converting an audio Blob to base64 and then decrypting it and creating a file on the server. Base64 is huge and breaks the app, but if I create it client side it's no problem. However I don't want to expose API keys that I need in order to do so (which it does currently). Any ideas on what I could do?
4 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Creating a custom UserError
I want to use a custom UserError to create preconditions for my subcommands. I can't find any documentation examples on it. Anyone have any suggestions so that in my custom preconditions class I can call throw new UserError and have it go to my custom function?
40 replies
SIASapphire - Imagine a framework
Created by rhh4x0R on 7/18/2023 in #sapphire-support
Sharding via DJS and Sapphire
Hey y'all, I'm looking at the Discord.JS docs for sharding and wanting to implement that within Sapphire. From my search in this server I found to use the DJS method of using it as Sapphire doesn't support extra with that. However, there isn't a ShardManager included in Sapphire, and I still want to use the Sapphire Client options. Is that still possible with Sapphire or do I have to eliminate the SapphireClient completely (which defeats the purpose?) Cheers.
13 replies
DIAdiscord.js - Imagine an app
Created by rhh4x0R on 1/2/2023 in #djs-questions
Passing metadata from bot OAuth2 Invite link?
I'm wanting to pass a variable from an oauth2 invite link and then read it when the bot is added to the server. I'm not finding anything besides somehow passing 'state' in the URL -- but I'm not able to read it on the 'guild' object when I add it to the server. Any ideas? Thanks.
3 replies