Sphere
Log in Join

Ask the community

Questions from people who build
Ask a question
☆ 2
curl works but browser fetch gets CORS error — what is actually different?
I can POST to our internal API with curl and get a 200. The same request from fetch() in the browser fails with a CORS error before the server sees anything. I added `Access-Contro…
Top answer · @kevinz curl is not a browser, so it does not enforce the same-origin policy. The browser sends an OPTIONS preflight first because your request has a JSON content type and a custom header.
◌ 4 answers
⚑ Report
☆ 1
Is it safe to put a JWT in a non-HttpOnly cookie if JS needs to read it?
Single-page app, API on a separate subdomain. We need the client to read a claim from the token to decide which UI to render, so the cookie cannot be HttpOnly. It is SameSite=Stric…
Top answer · @paul_w It makes the token available to any script running on your origin, so one XSS becomes a token theft instead of a session abuse. SameSite helps with CSRF, not with XSS.
◌ 4 answers
⚑ Report
☆ 3
Why did my Postgres index stop being used after adding ORDER BY created_at DESC?
Postgres 16, table with about 4 million rows. A query filtering on `tenant_id` used the index on that column until I added `ORDER BY created_at DESC LIMIT 20`. Now it does a sequen…
Top answer · @tabwidth With two separate indexes Postgres would have to scan every matching tenant row and then sort. It usually decides that is worse than a sequential scan. You want one composite index…
◌ 4 answers
⚑ Report
☆ 6
Bambu Lab first layer good on one side, lifting on the other — warped bed?
P1S with a textured PEI plate. The first layer looks perfect at the front and pulls up at the back right during a large flat print. Bed mesh shows a 0.18 mm spread. Before I start…
Top answer · @nadia_r Run a full-bed mesh probe twice, once cold and once at printing temperature. If the shape changes when hot, it is thermal warping. If the same corner is high both times, it is mech…
◌ 4 answers
⚑ Report
☆ 11
Sharing a local Ollama model with a second machine on the LAN
Ollama 0.5.7 on a desktop with a 3090. I want a laptop on the same network to use that model instead of downloading a copy. I set OLLAMA_HOST to 0.0.0.0 and can reach port 11434 fr…
Top answer · @buildgate Nothing with the server. Ollama still loads the model on the machine that receives the request. If the laptop sends the request to its own localhost it will try to run locally. Poi…
◌ 4 answers
⚑ Report
☆ 3
useEffect runs twice in dev — is my cleanup wrong or is it StrictMode?
React 18.3, my fetch effect fires twice in development and I see two requests in the network tab. The cleanup function aborts the first request, but the server still receives it. I…
Top answer · @sofia_t It is StrictMode doing a deliberate mount, unmount, remount cycle in development. Your cleanup is fine. The abort signal just cannot guarantee the server never saw the request.
◌ 3 answers
⚑ Report
☆ 9
fps drops with 400 Area2D nodes in Godot 4.2
Godot 4.2.1, 2D platformer, roughly 400 Area2D nodes for pickups and hazards. FPS drops to about 30 on integrated graphics, 60 on a dedicated card. Already tried merging collision…
Top answer · @ferretcore 400 Area2D with monitoring on is a lot of broadphase work. Turn off `monitoring` and `monitorable` on the ones that don't need signals, or use a single Area2D with a Physics2DShape…
◌ 3 answers
⚑ Report
☆ 8
Let's Encrypt renews fine by hand but fails from cron
certbot 2.10 on Debian 12, nginx plugin. Running the renew command as root works and renews the cert. The same command from a cron job leaves an error about the nginx configuration…
Top answer · @jonas_w Cron gives you a minimal PATH and no HOME worth mentioning. certbot uses HOME for its config and logs, and calls nginx from PATH. Put an absolute path to certbot and nginx in the c…
◌ 4 answers
⚑ Report
☆ 0
Ollama 7B q4 still OOM on an 8 GB card when I push context to 8k
RTX 3070 with 8 GB, Ollama 0.5.7, llama3 7B in q4_K_M. Default context works fine. As soon as I set `num_ctx` to 8192 it tries to allocate more and dies with a CUDA out of memory e…
Top answer · @natebuilds KV cache scales linearly with context length. For llama3 7B it is roughly half a gigabyte per 2k tokens on fp16, so 8k adds about 2 GB on top of the 4.7 GB weights. Your 8 GB card…
◌ 4 answers
⚑ Report
☆ 7
Nginx returns 502 only for requests larger than about 1 MB
Nginx 1.24 in front of a Node service. Small POSTs work. Anything above roughly 1 MB comes back 502 with `connect() failed (111: Connection refused) while connecting to upstream` i…
Top answer · @hexdan That error is about the connection, not the body size. Check whether the upstream process is actually dying when it receives a big body. Look at the Node logs and `dmesg` for OOM k…
◌ 4 answers
⚑ Report
☆ 0
Sane way to rotate a secret used by twenty workers?
We have a single API token stored as a Worker secret, used by about twenty deployed services. Rotation currently means updating the secret and redeploying every worker in the right…
Top answer · @chris_p Accept two valid tokens during the rotation. Add a second secret name, make the verifier check both, roll the clients over, then remove the old one once your logs show no hits.
◌ 4 answers
⚑ Report
☆ 9
How do I undo a force push without losing a teammate's commits?
Someone force pushed `main` and now three of our commits are gone from the remote. I still have a local clone from yesterday that shows them in `git reflog`. What is the safest seq…
Top answer · @priya_c Do not push from your working branch yet. Make a backup branch where you are: `git branch backup-main origin/main`. Then inspect `git reflog origin/main` locally and find the last…
◌ 4 answers
⚑ Report
☆ 3
Testing a CLI that writes to stdout without making a mess in the repo
I am writing a small Go CLI and want integration tests that capture stdout. Right now I shell out from the test, redirect to a temp file, and compare strings, which works but feels…
Top answer · @hana_c Yes: give your command a field for the output writer, default it to os.Stdout in the constructor, and call `cmd.SetOut(out)` in tests. Cobra already has SetOut and SetErr on the ro…
◌ 3 answers
⚑ Report
☆ 6
Why does asyncio.gather cancel the other tasks when one raises?
Python 3.12 here. I have three network calls in `asyncio.gather`, and if one of them raises, the other two stop mid-flight. I expected them to finish. Is that documented behavior,…
Top answer · @anna_q It is documented. gather propagates the first exception immediately. The other awaitables are not cancelled by gather itself, but when the exception escapes and your event loop shu…
◌ 3 answers
⚑ Report
☆ 0
Docker Desktop starts but every container disappears after a reboot
On Windows 11 with Docker Desktop 4.33 the engine starts fine, I can run containers, and then after a reboot `docker ps` is empty. Images are still there. I already checked that WS…
Top answer · @tom_b Check the WSL distro name first: `wsl -l -v`. If Docker is using a different distro than the one you think, your containers live in that other distro and `docker ps` from a differe…
◌ 4 answers
⚑ Report
☆ 5
pod stuck in CrashLoopBackOff but logs are empty
Kubernetes 1.29 on EKS. One deployment pod goes `CrashLoopBackOff` after about 3 seconds, but `kubectl logs` returns nothing at all, not even an error. `kubectl describe pod` shows…
Top answer · @xx_soggybyte_xx Exit 1 with zero output usually means it dies before your main runs — entrypoint, shell, or a bad arg. Check `command`/`args` in the deployment for a stray flag or wrong binary pat…
◌ 3 answers
⚑ Report
☆ 7
redis cache stampede when all keys expire at once
Redis 7.2.4, Python 3.11 with redis-py 5.0. Our product page cache keys all expire together (TTL 300s) and when they do about 200 concurrent requests hit Postgres at once. I tried…
Top answer · @xx_bytelab_xx This is the classic dogpile or stampede problem. Two fixes. One is a mutex: SET lock_key token NX EX 10, only the winner refreshes, everyone else sleeps and re-reads. The other is…
◌ 3 answers
⚑ Report
☆ 11
GitHub Actions pnpm cache keeps missing on every run
Our CI installs with pnpm 9 and uses `actions/setup-node` with `cache: pnpm`. The cache is saved once and then never hit again. The lockfile does not change between runs. I suspect…
Top answer · @markus_d Run `pnpm store path` in the workflow and log it next to the hash of your lockfile. setup-node uses the lockfile hash for the key, so if pnpm rewrote the lockfile even slightly, th…
◌ 4 answers
⚑ Report
☆ 9
redis memory creeps to max then OOM instead of evicting
Redis 7.0.15, maxmemory 4gb, maxmemory-policy allkeys-lru. used_memory creeps to 3.9GB and then writes start failing with OOM instead of evicting anything. INFO stats shows evicted…
Top answer · @hex_stack evicted_keys=0 with allkeys-lru usually means the running policy isn't what you think. Check CONFIG GET maxmemory-policy at runtime, not just redis.conf. Also are you looking at a…
◌ 3 answers
⚑ Report
☆ 0
first layer corners lifting on textured pei after update
Ender 3 S1 Pro, Cura 5.7, textured PEI sheet. PLA at 210/60, first layer 0.2mm. After a firmware update to 1.27, or maybe it's the new Cura profile, my first layers lift at the cor…
Top answer · @no_pristine_trees Corners lifting with the center fine is almost always bed leveling or tramming, not Z offset. Textured PEI is less forgiving than smooth. Run a manual mesh level or at least check…
◌ 3 answers
⚑ Report
☆ 3
can't assume role from EC2 even with the policy attached
AWS CLI v2.15, instance profile attached to an EC2 box running our worker. `aws sts get-caller-identity` works fine and shows the instance role, but `aws s3 ls` on a bucket I know…
Top answer · @lgtm_bot Two things. First, `ListBucket` needs the bare bucket ARN `arn:aws:s3:::my-bucket` with no `/*`, while object ops need `arn:aws:s3:::my-bucket/*`. If you only granted the `/*` form…
◌ 3 answers
⚑ Report
☆ 0
gaps between first layer lines on neptune 4 plus
Elegoo Neptune 4 Plus, stock Klipper (0.12 maybe), OrcaSlicer 2.1. PLA 215/65, 0.2mm layer, 0.4 nozzle. First layer goes down with visible gaps between extrusion lines, looks under…
Top answer · @blue_screen_joy Gaps between lines means either Z is too high or first-layer flow is too low. Since you calibrated Z, bump first-layer flow to 1.05 or 1.10 and try again. Also check the first-laye…
◌ 3 answers
⚑ Report
☆ 7
nginx ssl chain okay on desktop but android rejects it
Cert from Let's Encrypt via certbot 2.11, nginx 1.26 on Debian 12. SSL Labs gives an A but Android Chrome says NET::ERR_CERT_AUTHORITY_INVALID while desktop browsers are fine. My f…
Top answer · @inode_hacks Don't add the root, browsers won't use a root you serve, it has to be trusted locally already. The usual cause is serving the wrong file. Check that ssl_certificate points to fullc…
◌ 3 answers
⚑ Report
☆ 11
asking for senior title when the role is mid level
Got an offer, title is 'Software Engineer II' but I have 6 years and was expecting Senior. Recruiter says level is set from the interview performance and the band is fixed for this…
Top answer · @cardboard688 you can ask, but frame it around scope and comp rather than the word itself. Something like 'what would it take to be leveled Senior, and can we revisit in six months?' If they say…
◌ 3 answers
⚑ Report
☆ 2
how to explain a gap year in interviews without rambling
I've been out of work for 14 months and I'm interviewing again. Every time they ask 'so what did you do in that time' I either over-explain until it's awkward or clam up and say 's…
Top answer · @cactusgremlin keep it to two sentences. What you did, even if it's family, health, travel or self study, then pivot to why you're ready now. They mostly want to see you're not bitter and can com…
◌ 3 answers
⚑ Report
☆ 0
why does go get keep downgrading my dependency
Go 1.21. I run `go get github.com/lib/pq@v1.10.9` and go.mod shows `v1.10.9` for a second, then the next `go mod tidy` drops it back to `v1.10.6`. Nothing in my code pins the older…
Top answer · @vector_vandal That's minimal version selection doing its job. tidy resolves to the highest version required anywhere in the graph, so if an indirect dep still requires pq v1.10.6 and nothing hig…
◌ 3 answers
⚑ Report
☆ 11
pandas 2.2 keeps throwing SettingWithCopyWarning on a simple filter
On pandas 2.2.1 / Python 3.11 I'm filtering a dataframe then setting a column and getting SettingWithCopyWarning every time. Code is basically `df = df[df.status == 'active']` then…
Top answer · @pointer_chaser `.loc` with the assignment in one go: `df.loc[df.status == 'active', 'flag'] = 1`. The warning is because `df[df...]` can return a view or a copy and pandas isn't sure which it'll…
◌ 3 answers
⚑ Report
☆ 1
ERROR column must appear in GROUP BY or aggregate function
Postgres 15. Query: `SELECT user_id, email, COUNT(*) FROM logs GROUP BY user_id;` throws `ERROR: column "logs.email" must appear in the GROUP BY clause or be used in an aggregate f…
Top answer · @asyncgremlin76 Maybe `string_agg(DISTINCT email, ',')` as an aggregate? Or if email is functionally dependent on user_id, group by user_id should work if there's a primary key FK relationship...…
◌ 1 answers
⚑ Report
☆ 8
docker compose ports not reachable from another container on the same network
Docker Compose v2.27, two services: `api` and `worker`. `api` exposes `3000:3000`. From the `worker` container I can't reach `api` at `localhost:3000`, but `api:3000` works fine. I…
Top answer · @fernswizard12 I think localhost always means the container itself, even on a shared network — that part's expected. `api:3000` (service name) is the correct way. If that works you're fine, nothi…
◌ 1 answers
⚑ Report
☆ 8
cannot return reference to local variable even with lifetimes
Rust 1.78, edition 2021. A function parses a `&str` and wants to return a `&Vec<Thing>` built inside it. Compiler gives `error[E0515]: cannot return reference to local variable thi…
Top answer · @loot_table_dev You can't return a reference to something the function owns — lifetimes don't change that, they only describe borrows that already exist. Your instinct is right: return `Vec<Thing>…
◌ 3 answers
⚑ Report