Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not render "value of stdout.lastframe() is undefined" if the output is an empty string #2912

Merged

Conversation

petebacondarwin
Copy link
Contributor

@petebacondarwin petebacondarwin commented Mar 17, 2023

Fixes #2907

What this PR solves / how to test:

If the components passed to renderToString() resulted in an empty string, we were incorrectly converting that to a warning message. This message should only apply if there is a problem with rendering and it returns undefined.

To test run the following commands:

npx wrangler d1 create TEST_DB 
npx wrangler d1 execute TEST_DB --command "DROP TABLE IF EXISTS test_table"

You should not see the "value of stdout.lastframe() is undefined" message.

Author has included the following, where applicable:

  • Tests D1 query execution is not possible to unit test - the WASM causes a segmentation fault in NodeJS.
  • Changeset (Changeset guidelines)

Reviewer has performed the following, where applicable:

  • Checked for inclusion of relevant tests
  • Checked for inclusion of a relevant changeset
  • Checked for creation of associated docs updates
  • Manually pulled down the changes and spot-tested

@petebacondarwin petebacondarwin requested a review from a team as a code owner March 17, 2023 10:59
@changeset-bot
Copy link

changeset-bot bot commented Mar 17, 2023

🦋 Changeset detected

Latest commit: 8f383e6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/4446793807/npm-package-wrangler-2912

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/2912/npm-package-wrangler-2912

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/4446793807/npm-package-wrangler-2912 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/4446793807/npm-package-cloudflare-pages-shared-2912

Note that these links will no longer work once the GitHub Actions artifact expires.

@codecov
Copy link

codecov bot commented Mar 17, 2023

Codecov Report

Merging #2912 (8f383e6) into main (163dccf) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2912      +/-   ##
==========================================
+ Coverage   74.06%   74.09%   +0.02%     
==========================================
  Files         167      167              
  Lines       10418    10418              
  Branches     2785     2785              
==========================================
+ Hits         7716     7719       +3     
+ Misses       2702     2699       -3     
Impacted Files Coverage Δ
packages/wrangler/src/utils/render.ts 92.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

Copy link
Contributor

@rozenmd rozenmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed this fixes the issue via preview build

@Qxxxx
Copy link

Qxxxx commented Apr 13, 2023

I don't know if it stops statements excution. I have three slq commands in .sql file but only one statement is excuted.

🌀 Mapping SQL input into an array of statements
🌀 Parsing 3 statements
🌀 Executing on DB (DBID):
🚣 Executed 1 command in 0.01684001088142395ms
value of stdout.lastframe() is undefined

Copy link
Contributor

@JacobMGEvans JacobMGEvans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! We have had turning some things to ?? be a problem glad to see it fix stuff too lol

@rozenmd rozenmd merged commit 5079f47 into cloudflare:main May 5, 2023
@github-actions github-actions bot mentioned this pull request May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 BUG: value of stdout.lastframe() is undefined is returned with some Wrangler commands
4 participants