Sheik
Sheik3mo ago

'Deno.exit' is not allowed in this context.

Locally I can do in a nest project npm run build deno run -A .enviroment/deploy.ts and it works correctly, but when I upload it to deno deploy, it gives me this error: PermissionDenied: 'Deno.exit' is not allowed in this context. My deploy.yml
name: Deploy
on:
push:
branches: main
pull_request:
branches: main

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest

permissions:
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*

- name: Build step
run: "npm install && npm run build && node node_modules/tsc-alias/dist/bin/index.js -f dist/"

- name: Upload to Deno Deploy
uses: denoland/deployctl@v1
with:
project: "ricardonest"
entrypoint: ".enviroment/deploy.ts"
root: ""
name: Deploy
on:
push:
branches: main
pull_request:
branches: main

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest

permissions:
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*

- name: Build step
run: "npm install && npm run build && node node_modules/tsc-alias/dist/bin/index.js -f dist/"

- name: Upload to Deno Deploy
uses: denoland/deployctl@v1
with:
project: "ricardonest"
entrypoint: ".enviroment/deploy.ts"
root: ""
No description
3 Replies
Deno AI Helper
Deno AI Helper3mo ago
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the error message you've provided, it seems like there might be an issue with the way imports are being resolved in your code. The error message Relative import path "@nestjs/core" not prefixed with / or ./ or ../ suggests that the import statement for @nestjs/core might not be compatible with Deno's module resolution. Deno requires that all imports from local files are relative paths (starting with ./ or ../) or absolute paths (starting with /). Since @nestjs/core looks like a package name rather than a local file, this might be causing the issue. Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of the advice given. It's also worth noting that NestJS is typically associated with the Node.js ecosystem, and Deno has a different set of standards for modules and third-party packages. If you're trying to deploy a NestJS application on Deno Deploy, you may need to ensure that all your dependencies and import statements are compatible with Deno's import resolution.
Sheik
Sheik3mo ago
No description
marvinh.
marvinh.3mo ago
@Sheik The Deno.exit method is not available on Deno Deploy. Only the following Deno.* APIs are present https://docs.deno.com/deploy/api#deno-apis Deno Deploy is a serverless platform, so the v8 isolate will shut down automatically after no requests have been received for a while