denoland / denoland/deploy_feedback

memory soft limit exceeded

Open
#292 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
No language data
Stars
79
Forks
5
PR merge metrics
No merged PRs in 30d

Description

I'm receiving the following error, but unsure as to what causes it. I haven't found a way to diagnose the problem within the Deno dashboard, where none of my logs from my code is showing up.

```
memory soft limit exceeded, terminated
memory soft limit exceeded, on probation
Server running on port 8085
europe-west4 isolate start time: 1.94 ms
```

I tried upgrading my account to Pro, hoping it would solve the issue. That didn't work, either.

I'm using Deno for my website. I'm showing my latest starred repos by accessing the GitHub API. That works fine. Sometimes.

Additionally, I've added a caching layer with Upstash, which seems to be causing the issue.

Not to use this as a support ticket, but rather to show my use-case, here's my code:

```
export async function getStarredRepos() {
const cache = await upstashRequest('/get/my-starred-repos')

if (cache) {
console.log('My starred repos: cache hit')

return cache.repos
}

console.log('My starred repos: cache miss')

const response = await fetch(
'https://api.github.com/users/casperengl/starred?per_page=10',
{
headers: {
Authorization: `token ${import.meta.env.GITHUB_API_KEY}`,
},
}
)

const json = await response.json()
const expires = ms('1 hour') / 1000 // ms to seconds
const repos: Repo[] = json
.filter((repo) => !repo.private)
.map((repo) => ({
html_url: repo.html_url,
full_name: repo.full_name,
}))

await upstashRequest(`/set/my-starred-repos?EX=${expires}`, {
method: 'POST',
body: JSON.stringify({
expiresAt: new Date(Date.now() + ms('1 hour')).toISOString(),
repos,
}),
})

return repos
}
```

The `upstashRequest` is a thin wrapper around `fetch` that sends the request to Upstash's REST API. I thought maybe `JSON.stringify` got too much data, which caused the memory to flow beyond the runtime limit, but I'm down to only stringifying about 900b now, which I'm assuming should be small enough to handle.

The root of this issue is a cry for a way of debugging these sorts of problems. I would be willing to change the solution if I knew the underlying problem, but I cannot figure it out if I can't debug it.

Contributor guide

No contributing guide indexed for this repository

Research direction

No repository files or tests are named. Start by reproducing the inline TypeScript getStarredRepos flow with the GitHub API and Upstash requests, then inspect the Deno dashboard and runtime output; done means identifying the memory-limit trigger or defining diagnostics that expose it.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, typescript
Domain
cloud, observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.