Bird
Raised Fist0
Denoframework~20 mins

Deploying to Deno Deploy - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Deno Deploy Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate
2:00remaining
What happens when you deploy a Deno script with an unhandled promise rejection?
Consider a Deno Deploy script that contains an async function which rejects a promise but does not catch the error. What will be the behavior when this script runs on Deno Deploy?
Deno
addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request));
});

async function handleRequest(request) {
  await Promise.reject(new Error('Oops!'));
  return new Response('Hello World');
}
AThe rejection is ignored and the response 'Hello World' is sent successfully.
BThe deployment will fail with a syntax error before running.
CThe script will crash and Deno Deploy will return a 500 Internal Server Error response.
DDeno Deploy automatically retries the request until the promise resolves.
Attempts:
2 left
💡 Hint
Think about how unhandled promise rejections affect serverless environments.
📝 Syntax
intermediate
1:30remaining
Which import statement correctly loads a third-party module in Deno Deploy?
You want to import the Oak web framework from a URL in your Deno Deploy project. Which import statement is correct?
Aimport { Application } from './oak';
Bimport Application from 'oak';
Cconst Application = require('oak');
Dimport { Application } from 'https://deno.land/x/oak@v12.5.0/mod.ts';
Attempts:
2 left
💡 Hint
Deno uses URL imports for third-party modules.
🔧 Debug
advanced
2:00remaining
Why does this Deno Deploy script fail to respond?
This script is deployed to Deno Deploy but clients never receive a response. What is the cause?
Deno
addEventListener('fetch', event => {
  handleRequest(event.request);
});

async function handleRequest(request) {
  return new Response('Hello from Deno Deploy');
}
AThe Response constructor is used incorrectly and throws a runtime error.
BThe event.respondWith() method is missing, so the response is never sent.
CThe fetch event listener is not supported in Deno Deploy.
DThe async function handleRequest must be synchronous to work.
Attempts:
2 left
💡 Hint
How does Deno Deploy know what to send back to the client?
❓ lifecycle
advanced
1:30remaining
How does Deno Deploy handle environment variables during deployment?
You set environment variables in the Deno Deploy dashboard for your project. When and how are these variables available to your script?
AEnvironment variables are injected at runtime and accessible via Deno.env.get() inside the script.
BEnvironment variables must be imported as modules before use.
CThey are only available during build time and not at runtime.
DDeno Deploy does not support environment variables.
Attempts:
2 left
💡 Hint
Think about how serverless platforms provide secrets and config to running code.
🧠 Conceptual
expert
2:30remaining
What is the effect of using the 'unstable' flag in Deno Deploy scripts?
You deploy a Deno script to Deno Deploy with the --unstable flag enabled. What does this allow you to do?
AUse experimental Deno APIs that are not yet stable but may change in the future.
BEnable automatic retries on failed requests in Deno Deploy.
CAllow the script to run indefinitely without timeout.
DDisable all security permissions for the script.
Attempts:
2 left
💡 Hint
Consider what 'unstable' means in software development.

Practice

(1/5)
1. What is the main purpose of deno deploy in Deno?
easy
A. To run Deno scripts locally without internet
B. To install Deno on your computer
C. To create a new Deno project template
D. To publish your Deno app online as a serverless function

Solution

  1. Step 1: Understand the command purpose

    deno deploy is used to publish apps online, not for local installs or running scripts.
  2. Step 2: Match the description to the command

    Publishing as serverless functions matches the description of deno deploy.
  3. Final Answer:

    To publish your Deno app online as a serverless function -> Option D
  4. Quick Check:

    deno deploy = publish app online [OK]
Hint: Remember: deploy means publish online [OK]
Common Mistakes:
  • Confusing deploy with install
  • Thinking deploy runs code locally
  • Assuming deploy creates projects
2. Which of the following is the correct command to deploy a Deno project located in the current folder?
easy
A. deno deploy --install
B. deno deploy .
C. deno run deploy
D. deno start deploy

Solution

  1. Step 1: Identify the correct deploy syntax

    The command deno deploy . tells Deno to deploy the current folder project.
  2. Step 2: Check other options for correctness

    Options B, C, and D are invalid commands for deployment.
  3. Final Answer:

    deno deploy . -> Option B
  4. Quick Check:

    Deploy current folder = deno deploy . [OK]
Hint: Use dot (.) to deploy current folder [OK]
Common Mistakes:
  • Using deno run instead of deno deploy
  • Adding wrong flags like --install
  • Using deno start which is not a Deno command
3. Given this command run in your terminal: deno deploy https://github.com/user/myapp, what will happen?
medium
A. Deno will deploy the app from the GitHub repo URL as a serverless app
B. Deno will clone the repo locally but not deploy
C. Deno will throw a syntax error because URLs are not allowed
D. Deno will run the app locally without deploying

Solution

  1. Step 1: Understand deploying from a repo URL

    Deno Deploy supports deploying directly from GitHub repo URLs.
  2. Step 2: Analyze the command behavior

    The command deploys the app serverlessly from the given URL, no local clone or syntax error occurs.
  3. Final Answer:

    Deno will deploy the app from the GitHub repo URL as a serverless app -> Option A
  4. Quick Check:

    Deploy from URL = deploy serverless app [OK]
Hint: Deploy accepts GitHub URLs directly [OK]
Common Mistakes:
  • Thinking deploy clones repo locally
  • Assuming URLs cause syntax errors
  • Confusing deploy with local run
4. You run deno deploy myapp but get an error saying "No such file or directory". What is the most likely cause?
medium
A. You forgot to install Deno before deploying
B. The internet connection is down
C. The folder or file named 'myapp' does not exist in the current directory
D. You need to run deno run myapp first

Solution

  1. Step 1: Interpret the error message

    "No such file or directory" means the path 'myapp' is missing locally.
  2. Step 2: Match error to cause

    Since deploy expects a valid path or URL, missing folder causes this error.
  3. Final Answer:

    The folder or file named 'myapp' does not exist in the current directory -> Option C
  4. Quick Check:

    Missing folder = No such file error [OK]
Hint: Check folder exists before deploying [OK]
Common Mistakes:
  • Assuming Deno is not installed
  • Blaming internet connection for local file errors
  • Confusing deploy with run command
5. You want to deploy a Deno app that uses environment variables securely on Deno Deploy. Which approach is best?
hard
A. Set environment variables in Deno Deploy dashboard and access them via Deno.env.get()
B. Hardcode environment variables in your source code before deploying
C. Pass environment variables as command line arguments to deno deploy
D. Store environment variables in a local .env file and deploy it with your app

Solution

  1. Step 1: Understand environment variable best practices

    Hardcoding or deploying .env files risks exposing secrets publicly.
  2. Step 2: Use Deno Deploy features

    Deno Deploy dashboard allows secure environment variable setup accessed by Deno.env.get().
  3. Final Answer:

    Set environment variables in Deno Deploy dashboard and access them via Deno.env.get() -> Option A
  4. Quick Check:

    Secure env vars = dashboard + Deno.env.get() [OK]
Hint: Use dashboard for env vars, not code files [OK]
Common Mistakes:
  • Hardcoding secrets in code
  • Uploading .env files publicly
  • Trying to pass env vars via deploy command
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard