deploy_feedback icon indicating copy to clipboard operation
deploy_feedback copied to clipboard

[Bug]: Deployment of a sveltke-kit app fails, telling me that I'm not using the svelte-deno-adapter when I am.

Open pdenapo opened this issue 2 years ago • 2 comments

Problem description

I have a svelte-kit app in Deno Deploy.

When I imported in into deno, it complais that it is not using svelte-adapter-deno. But this is not true.

Here is my svelte.config.js

import adapter from 'svelte-adapter-deno';


/** @type {import('@sveltejs/kit').Config} */
const config = {
	kit: {
		// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
		// If your environment is not supported or you settled on a specific environment, switch out the adapter.
		// See https://kit.svelte.dev/docs/adapters for more information about adapters.
		adapter: adapter()
	}
};

export default config;

and it is also in package.json.

When commiting to github after that, the deploy fails with a strange message in the deploy log

Finishing deployment... Error: TypeError: terminated

However, my site just works in Deno Deploy.

Steps to reproduce

clone my repository

https://github.com/pdenapo/svelte-app-deno.git

and import in into Deno Deploy

Expected behavior

Deploy the site without errors.

Environment

Everthing is done through github actions

name: ci

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  deploy:
    name: deploy
    runs-on: ubuntu-latest
    permissions:
      id-token: write
      contents: read

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

      - name: Install Node
        uses: actions/setup-node@v2
        with:
          node-version: 16

      - name: Cache pnpm modules
        uses: actions/cache@v2
        with:
          path: ~/.pnpm-store
          key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
          restore-keys: |
            ${{ runner.os }}-

      - name: Install pnpm and node_modules
        uses: pnpm/action-setup@v2
        with:
          version: latest
          run_install: true

      - name: Copy bootstrap 
        run:  ./copiar_en_static.sh
        shell: bash     

      - name: Build site
        run: pnpm build

      - name: Deploy to Deno Deploy
        uses: denoland/deployctl@v1
        with:
          project: far-deer-44
          entrypoint: 'build/index.js' 

Possible solution

No response

Additional context

No response

pdenapo avatar Sep 05 '23 15:09 pdenapo

This would be much easier if you provide a template for the supported frameworks (like you do for Fresh or like Vercel does)

pdenapo avatar Sep 05 '23 15:09 pdenapo

There are 2 sveltekit adapters in npm: svelte-adapter-deno and sveltekit-adapter-deno.

We only detect the latter sveltekit-adapter-deno as the adapter for Deno Deploy because the former one has major issue in bundling ( https://github.com/pluvial/svelte-adapter-deno/issues/40 ) , but it doesn't solve it for long time (it doesn't look maintained anymore).

Finishing deployment... Error: TypeError: terminated

This seems caused by uploading too many files (4679 files) to Deno Deploy. This is caused because node_modules directory is remaining from previous steps, and denoland/deployctl tries to upload everything in the current dir. If I replaced pnpm build to pnpm build && rm -rf node_modules in my forked repository, denoland/deployctl action ran successfully.

My change: https://github.com/kt3k/svelte-app-deno/commit/0b67e4d99f7d5f8b6b80f98d2364c831f2292f6b CI run: https://github.com/kt3k/svelte-app-deno/actions/runs/6136568287/job/16651530818

kt3k avatar Sep 10 '23 10:09 kt3k